php - How to get time at midnight of an user from my server? -
i have user timezone (for example: +7 gmt).
in php language:
- my server set timezone @ 0-gmt.
- how know server midnight of user?
assuming have timezine of user saved (i'll use america/los_angeles
since gmt -7 right now)
$user_tz = 'america/los_angeles'; // db $dt = new datetime(); $dt->settimezone(new datetimezone($user_tz)) if ($dt->format('g') == 0 && $dt->format('i') == '00') { echo "it's midnight"; }
Comments
Post a Comment