user2557039
user2557039

Reputation: 71

Dealing with time zones for a day

I set the month, day and year like this:

$mm = date("m");
$yy = date("Y");
$day = date("d"); 

And then in a mysql query I select based on $day.

How do I deal with time zones? If someone in california runs this at 11pm their time it will be incorrect (my server is EST).

I tried to use offset but this changed the whole day ahead. This does not work

$offest = '+1';
$day = date('d', strtotime($offset));

That just changes the date regardless of time.

I do have the fields stored as datetime.

Upvotes: 0

Views: 32

Answers (1)

Reistlin
Reistlin

Reputation: 81

use function time() example:

time()+3600(1 hours)
$date = date('d',time);

Upvotes: 1

Related Questions