I am new to this forum and learning to code.
I want to ask how can I change the time stamp to current timezone or is there any way I can convert the timestamp date/time to my current time zone America/Toronto or -4:00
I tried every single option available for MySQL and Cpanel. (htacces, phpini, settimezone in mysql)
Now I am planning to do with PHP as it will be better.
This is the code which is fetching the timestamp from table
<?php echo htmlentities($result->PostingDate);?>
Please tell me a suitable way to convert the time to current timezone
2
Answers
You can do something like this
which in this case the host uses the time zone MST (GMT-7). But Why not use UTC() time?
If you know your current timezone that your PostingDate is set to, and you want to do it with PHP code, you can try this:
List of supported timezones: https://www.php.net/manual/en/timezones.php