SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's what I'm trying to do: I want to convert the current (at time of script execution) date to Pacific Time, but do it independent of whatever timezone the server's in. I figured computing from GMT would be what I need. Pacific Time is -8 hours standard and -7 hours during daylight savings time from GMT.

    Is this the right code to do it with?

    PHP Code:
    $offset=(date("I")) ? 8;
    $date=gmdate("Y-m-d",gmmktime(gmdate("G")-$offset,gmdate("i"),
    gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y"))); 
    My main concern is that if the current hour in Greenwich less 8 hours comes to a negative number, will it properly shove the day back?

    Thanks for the help.
    Ed Rands

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it will.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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