tradet Posted September 23, 2008 Share Posted September 23, 2008 I need to get this: $now = date("D, d M Y H:i:s T"); //$now = ex. 'Tue, 23 Sep 2008 12:06:00 CEST' Into this: //$now = ex. 'Tue, 23 Sep 2008 10:06:00 GMT' ??? Link to comment https://forums.phpfreaks.com/topic/125446-format-cest-to-gmt/ Share on other sites More sharing options...
dave_sticky Posted September 23, 2008 Share Posted September 23, 2008 There are probably more glamorous ways of doing this, but: <?php $now = mktime(date('H'),date('i'),date('s'),date('m'),date('d'),date('Y')); $gmt = $now - 7200; echo date("D, d M Y H:i:s T",$gmt); ?> Link to comment https://forums.phpfreaks.com/topic/125446-format-cest-to-gmt/#findComment-648540 Share on other sites More sharing options...
tradet Posted September 24, 2008 Author Share Posted September 24, 2008 Thx, got it working with $now = mktime(date('H'),date('i'),date('s'),date('m'),date('d'),date('Y')); $gmt = $now - 7200; $now = date("D, d M Y H:i:s \G\M\T",$gmt); However now I've got a new problem. I need to format a mysql timestamp, such as: '2008-09-22 15:38:19' //also in CEST Into the format: 'Wed, 22 Sep 2008 13:38:19 GMT' Link to comment https://forums.phpfreaks.com/topic/125446-format-cest-to-gmt/#findComment-649340 Share on other sites More sharing options...
PFMaBiSmAd Posted September 24, 2008 Share Posted September 24, 2008 Use the mysql CONVERT_TZ() and DATE_FORMAT() functions in your SELECT query. Link to comment https://forums.phpfreaks.com/topic/125446-format-cest-to-gmt/#findComment-649353 Share on other sites More sharing options...
tradet Posted October 1, 2008 Author Share Posted October 1, 2008 This is what I've tried but don't know what's wrong: SELECT * FROM blog CONVERT_TZ(date_entered,'GMT','CEST') DATE_FORMAT(date_entered, '%a, %d %b %Y %H:%i:%s') limit 15 Link to comment https://forums.phpfreaks.com/topic/125446-format-cest-to-gmt/#findComment-654665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.