SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Time Problem

    High,

    I'm trying to echo out the local time - I live in the UK so I tried gmdate() - The only problem is that it doesn't seem to take into account the hour change for summer time - ie its one hour behind.

    Does anyone know a solution??

    Cheers

  2. #2
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Work out the time difference in seconds and stick it in a variable:
    PHP Code:
    $time_difference = -3600// 60 seconds * 60 minutes = 1 hour 
    Now apply the stored time difference to a value grabbed from the time() function whenever you want to display a date (using the date() function to format the date):
    PHP Code:
    $time time() + $time_difference;
    $formatted_date date ("l dS of F Y h:i:s A"$time); 
    Experiment with the $time_difference variable until you get it right

  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers


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
  •