SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to get today's date when it is not the server date?

    Hi,

    My site sits on a server in the US but the members are mainly from New Zealand. There is a 16 hour time difference.

    I am playing with a "Members Online Today" script.

    I can get the members online today but it relates to the server time, so at 4pm our New Zealand time there is suddenly 0 members online today as it resets itself when the server clocks over past midnight.

    One column in the table is called user_lastvisit - it is an int(10) - it stores the date and time as a timestamp

    This is the code that I have at the mo

    PHP Code:
    WHERE user_lastvisit UNIX_TIMESTAMP(CURDATE()) 
    I have been trying to work out how to change the CURDATE to add on 16 hours.

    Any ideas or suggestions would be great or even not using UNIX_TIMESTAMP(CURDATE() and something completely different. I have just released I also need to allow for daylight saving ....

    Thank you for your time

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Tags for this Thread

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
  •