ankycooper Posted November 30, 2006 Share Posted November 30, 2006 heythe following gives me time in GMTCode:$today = date("F j, Y, g:i a");However my time zone is IST and and my Machine is SET To ISTPlease Help Link to comment https://forums.phpfreaks.com/topic/29020-can-someone-fix-this/ Share on other sites More sharing options...
Psycho Posted November 30, 2006 Share Posted November 30, 2006 Unless you provide a timestamp as the second parameter, date() will revert to time(), which is the current local time - in other words, the current local time [i]of the web server[/i]. If you want the time to be in IST you need to provide the timestamp with the appropriate offset.I'm not familar with the IST timezone, but if IST is, for example, 5 hours ahead of GMT you could use this:$today = date("F j, Y, g:i a",(time()+60*60*5)); Link to comment https://forums.phpfreaks.com/topic/29020-can-someone-fix-this/#findComment-132976 Share on other sites More sharing options...
Zane Posted November 30, 2006 Share Posted November 30, 2006 [quote=http://php.net/date]// set the default timezone to use. Available since PHP 5.1date_default_timezone_set('UTC');[/quote]just call that BEFORE your date function Link to comment https://forums.phpfreaks.com/topic/29020-can-someone-fix-this/#findComment-133060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.