runder Posted August 7, 2007 Share Posted August 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/63648-converting-utc-to-local-time/ Share on other sites More sharing options...
jscix Posted August 7, 2007 Share Posted August 7, 2007 http://snippets.dzone.com/posts/show/1455 That should help. Quote Link to comment https://forums.phpfreaks.com/topic/63648-converting-utc-to-local-time/#findComment-317151 Share on other sites More sharing options...
runder Posted August 15, 2007 Author Share Posted August 15, 2007 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/63648-converting-utc-to-local-time/#findComment-324143 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.