Change default mysql date
For the last three days I have used the date to set the event dispatch etc, but automatically my server gave me one date.
I also use the default setting, for example:
date_default_timezone_set('Asia/Kolkata');
and use mysql code like:
$sql="insert into event set event_name = '".trim(ucfirst($data['event_name']))."' ,
event_description = '".trim(ucfirst($data['event_description']))."' ,
event_posted_date = now() ;
mysql_query($sql);
But it will keep one date.
Thanks and Regards
+3
source to share
3 answers
Try using date from PHP insted from NOW()
$today =date("Y-m-d H:is");
$sql="insert into event set event_name = '".trim(ucfirst($data['event_name']))."' ,
event_description = '".trim(ucfirst($data['event_description']))."' ,
event_posted_date = '$today' ";
OR
Find the file on the mysql server mysql.conf , view the default- timezone . Go toAsia/Kolkata
+1
source to share