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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.