Hello all, i googled for hours to get the date store in my db. I know i must keep the datatype as either date or datetime in coulmn. And i also got to know that i must use STR_TO_DATE to store values. i just want to have a coulmn storing date and time(Indian time) just to get the last 5 entries of my table.
i tried this
$timezone = new DateTimeZone("Asia/Kolkata" );
$date = new DateTime();
$phpdate=$date->setTimezone($timezone );
$query_autonow = "INSERT INTO customers (dateadded)
VALUE (STR_TO_DATE('$phpdate'))";
mysql_query($query_autonow) or die(mysql_error());
i tried various options but i get 0000-00-00 00:00:00.. or i get Fatal error: Class 'Date' not found in /home/update.php on line 6
[size=4]$date = new Date();
$query_autonow = "INSERT INTO customers (dateadded)
VALUE (STR_TO_DATE('$date'))";
$hh=mysql_query($query_autonow) or die(mysql_error());[/size]
when i use this....
if anybody have time, pls guide.. Many thanks in advances....