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


execute this mysql query before executing the query



$sql_set_time =  "SET time_zone = 'Asia/Kolkata' ";

      

0


source


are you on localhost or any other web server?

even if you installed date_default_timezone_set('Asia/Kolkata');

this function will show the date and time set for Asia / Kolkata on your server.

the date on your server might be wrong (if on localhost the system time might be wrong).

0


source







All Articles