Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2009
    Location
    McKinleyville, CA
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Inserting current local date

    On a form, I wish to insert the current local date for a user where ever they happen to be. My server's time is set for GMT. I started out using Date(), but found that 4:00 pm in the Pacific time zone, this began returning tomorrow's date.

    I replaced this with strftime(), thinking it was suppose to return the local date and time, it also shift one day at 4:00 pm. When I include the time in the strftime() output it clearly is 8 hours later.

    What should I be using to obtain the current date (and time) where ever the user is located?

  • #2
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #3
    New Coder
    Join Date
    Aug 2009
    Location
    McKinleyville, CA
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks for the response.

    I was looking for a way to detect the local day/time and use it. Your suggestion lets me fix the time zone to different zone than the server time, but not let it be relative to the location of the user.

    Or maybe I am missing something in how to use that function.


  •  

    Posting Permissions

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