www.webdeveloper.com
Results 1 to 8 of 8

Thread: how know the exact day of the timesaving?

  1. #1
    Join Date
    Oct 2008
    Posts
    72

    how know the exact day of the timesaving?

    hi,
    i have a server from a diferent country where i have 6 hours +/- of diference

    i have this function to return the correct hours
    but when the timesaving occor i need change the var "valor"
    for 0 or 1 because the timesaving

    function:\\\
    $valor=1;

    $hr = date("H:i:s", mktime(gmdate("H")+$valor, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d"), gmdate("Y")));
    return $hr;

    my question is there is a better solution for this and/or how can i find the exact day of the hour change? windows can determine the exact day without internet connection so i think there is some calc to check the date.

    any one can help me?
    thanks

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    Why? Just use date_default_timezone_set($timezone) to set the default timezone, and let PHP handle everything else on it's own?
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  3. #3
    Join Date
    Oct 2008
    Posts
    72
    hi,
    i will see that function thanks
    but i still need know how can i determine the date of the timesaving
    any ideia?
    thanks

  4. #4
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    PHP Code:
    date('I'
    will return '1' if it's DST, and '0' otherwise, I assume you can use (int) to cast it back to an integer.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  5. #5
    Join Date
    Oct 2008
    Posts
    72
    thanks a lot for your help

  6. #6
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    You know, come to look over your code I don't know why you can't use:

    PHP Code:
    $hr date("H:i:s"strtotime('+6 hours'));
    return 
    $hr
    But I'm sure there's a good reason.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  7. #7
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Quote Originally Posted by scragar View Post
    You know, come to look over your code I don't know why you can't use:

    PHP Code:
    $hr date("H:i:s"strtotime('+6 hours'));
    return 
    $hr
    But I'm sure there's a good reason.
    That would only work if both locations always start and finish daylight saving time on the same day. Setting the timezone will still work even when they don't start and end DST on the same day or where only one has DST.
    Stephen

  8. #8
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    Quote Originally Posted by felgall View Post
    That would only work if both locations always start and finish daylight saving time on the same day. Setting the timezone will still work even when they don't start and end DST on the same day or where only one has DST.
    Well I suggested that and it got shot down, I was only providing an alternate solution that's more than likely going to work since my first recommendation was rejected.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles