When getting the time via PHP script (time()), during Daylight Savings Time it seems to return a time value that is one hour off. Is there any way to get the correct time, accounting for Daylight Savings Time?
When getting the time via PHP script ( time() ), during Daylight Savings Time
Share
time()returns a Unix timestamp and a Unix timestamp is a fixed period of time: number of seconds since the Unix Epoch. It isn’t affected by time zones.Once you have the precise moment, you may want to calculate the local time in a given place:
… will print different local dates for the same timestamp:
The same reasoning applies for the opposite operation:
… will print different timestamps: