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

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 :slight_smile:

http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html

Also need to set the timezone for PHP
http://dk2.php.net/manual/en/function.date-default-timezone-set.php