Jump to content

Converting UTC to local time


runder

Recommended Posts

Hi,

 

My PHP connects with a postgresql database and fetches the last login information of type "timestamp with time zone".

 

The database returns this value: 2007-08-06 19:05:14.551719-06, but the actual time I have right now is 9:05:14 PM.  I assume the time given by the database is in UTC.  Now, how do I convert this to respect the local time of the user seeing this?

 

For example, I am located in eastern time zone and  I should be seeing 9:07:14 PM, but someone in central time zone should be seeing 8:05:14 PM.  Is there a PHP code that can convert this time into the local time of the current user viewing the time depending on his geographical location?

 

Thank you in advance.

Link to comment
https://forums.phpfreaks.com/topic/63648-converting-utc-to-local-time/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.