dncnllama Posted March 15, 2007 Share Posted March 15, 2007 Hi, have php installed on a server, in putty I go 'date' and get Thu Mar 15 12:52:05 PDT 2007 but if run php script with time(); in it time() returns: Friday, March 16th 2007, 5:51:29 (GMT +10) How do I get the php time to be same time as server? Really need help have been looking everywhere for answer to this. Link to comment https://forums.phpfreaks.com/topic/42795-setting-time-and-date-in-php/ Share on other sites More sharing options...
HaLo2FrEeEk Posted March 15, 2007 Share Posted March 15, 2007 What exactly do you want to do? You want your returned date from php to be the same format as the one you got from your shell client? Or vice versa? Link to comment https://forums.phpfreaks.com/topic/42795-setting-time-and-date-in-php/#findComment-207732 Share on other sites More sharing options...
dncnllama Posted March 15, 2007 Author Share Posted March 15, 2007 I want the date php gets to be the same as date that is set on the server. As when I do 'date' in putty and then do time() in php script - the times are different, so trying to find where php is getting time from. Link to comment https://forums.phpfreaks.com/topic/42795-setting-time-and-date-in-php/#findComment-207749 Share on other sites More sharing options...
kenrbnsn Posted March 15, 2007 Share Posted March 15, 2007 The time() functions just returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). It does not format it into what you're showing. The date() function does that. Please post the script you're testing between [/nocode] tags. Ken Link to comment https://forums.phpfreaks.com/topic/42795-setting-time-and-date-in-php/#findComment-207755 Share on other sites More sharing options...
HaLo2FrEeEk Posted March 15, 2007 Share Posted March 15, 2007 Its the time zone difference, putty is getting it from GMT+10, which is guam, php is getting it from PDT, which is eastern to central america, so php is probably getting it from where you are, and putty is getting where your server is. Thats what I think, and I don't know how to change it, other than telling php to get it from GMT+10 when you get the time. Link to comment https://forums.phpfreaks.com/topic/42795-setting-time-and-date-in-php/#findComment-207757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.