I want to insert current date and time in mysql using php. I dont want to set timezone in my init.php as this is not my requirement to force the user to set timezone everytime or once.
I am doing it:
echo "Today is " . date("d/m/Y") . "<br>";
echo "Time is " . date("g:m a") . "<br>";
$sys_timestamp = strtotime(exec("date"));
echo sys_timestamp;
I have tried NOW(), but it is also not solving my problem. I have tried systime(), time() as well.
I was trying to fix like below but it messed up all the timings.
date_default_timezone_set('Europe/Helsinki');
$updated_date = date("d-m-Y");
echo $updated_date;
$updated_time = date("g:i a");
echo $updated_time;
Not I dont want above solutions. I want to send common date and time on server for the whole website and I want when the user check the date & time, the date & time automatically convert it to their local time using php. Convert time from mysql inserted time to the user's location local time and date.
Kindly suggest what I am doing wrong.