Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.