Jump to content

Setting time and date in php


dncnllama

Recommended Posts

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

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.