Jump to content

DST detection...


darkcarnival

Recommended Posts

Not sure what you mean by "how do you actually detect dst"

if you are talking about detecting DST on the user end, then you can't - unless you were to ask them if they observe DST and you were to save that value for whenever you wanted to show that person a time.

On the server end you can use gettimeofday() which will return an array. one of the array values is "dsttime" - type of dst correction. That might be what you are looking for.
Link to comment
https://forums.phpfreaks.com/topic/26880-dst-detection/#findComment-122941
Share on other sites

The data function, as Monkeymatt showed, will tell you if a given date is within the daylight savings period.

Usage is like this: $dst = date('I', [i]timestamp[/i]);

$dst will be equal to 1 if the date is within the DST period or 0 if it is not.

The gettimeofday() function returns an array and one of the values will tell you if the server observes DST and another will tell you what the DST adjustment is for the server.

Usage is as follows:
$timearray = gettimeofday90;
$dstobserve =  = $timearray[dsttime]; // 0 or 1
$dstadjustment = $timearray[minuteswest]; //adjustment from standard time
Link to comment
https://forums.phpfreaks.com/topic/26880-dst-detection/#findComment-123019
Share on other sites

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.