www.webdeveloper.com
Results 1 to 2 of 2

Thread: mktime(gmdate) loses a day wtf?

  1. #1
    Join Date
    Feb 2005
    Location
    South Coast NSW Aus
    Posts
    48

    mktime(gmdate) loses a day wtf?

    When I run this code:

    PHP Code:
    echo '<br />Current UTC '.gmdate("H, i, s, m, d, Y"); 
    $gmtmst mktime(gmdate("H, i, s, m, d, Y")); // get current UTC time 
    echo '<br /<pre>'
    print_r(getdate($gmtmst)); 
    echo 
    '</pre>'
    I get this:

    Code:
    Current UTC 06, 00, 47, 02, 28, 2008
    
    Array
    (
        [seconds] => 47
        [minutes] => 0
        [hours] => 6
        [mday] => 27
        [wday] => 3
        [mon] => 2
        [year] => 2008
        [yday] => 57
        [weekday] => Wednesday
        [month] => February
        [0] => 1204120847
    )
    WTF?

  2. #2
    Join Date
    Feb 2005
    Location
    South Coast NSW Aus
    Posts
    48
    OK, a lot more searching and apparently to do this very, very simple function you need to use this code:

    PHP Code:
    $gmtmst strtotime(gmdate("M d Y H:i:s"time())) 

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