ultrus Posted April 21, 2009 Share Posted April 21, 2009 Hello, I'm have a GMT timestamp created from a an rss feed that I need to convert to a local time. I was thinking about just subtracting the offset (MST -700). However, that changes depending on daylight savings correct? Any thoughts on how to convert? Thanks much! Link to comment https://forums.phpfreaks.com/topic/155060-solved-adjust-a-gmt-timestamp-to-a-local-time-timestamp/ Share on other sites More sharing options...
rhodesa Posted April 21, 2009 Share Posted April 21, 2009 pass it to strtotime() to convert it to a timestamp...then you can use date() to reprint the date (and it will be in the timezone of the server)...example: <?php $ts = strtotime('2009-04-21 14:38:00 GMT'); print date('r',$ts); ?> Link to comment https://forums.phpfreaks.com/topic/155060-solved-adjust-a-gmt-timestamp-to-a-local-time-timestamp/#findComment-815586 Share on other sites More sharing options...
ultrus Posted April 21, 2009 Author Share Posted April 21, 2009 ah! How simple. But such a headache until you came along. Thanks much! I'm all set. Link to comment https://forums.phpfreaks.com/topic/155060-solved-adjust-a-gmt-timestamp-to-a-local-time-timestamp/#findComment-815597 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.