How can I make sure that something happens in php at a specific time and it happens at that time for each timezone?

I have read many different sites and many different solutions that deal with server timezones and times, client and user uptime, etc., but no one explains in detail this particular situation that I am trying to accomplish.

I have this php code that causes something to expire on specific dates and times and it works great, but only causes the content to expire on the server. I want it to expire in all timezones when that time comes for that timezone. I don't want the content to expire at the same time for all time zones.

so let's say I want something to expire at 2pm, in the very first timezone that falls at 2pm, they won't be able to see the expired content, but the rest of the timezones can still see it. then when the second timezone reaches 2pm, that timezone should not see the content. so now 2 time zones cannot see the content, but the other time zones should still see it. and this continues one time zone at a time until all time zones reach 2pm.

tell me how to set up this php to do above.

<?php
$end_date = strtotime('02:00pm April 1, 2012');
$now = time();
if ($end_date < $now) {
?>
different content to display after date and time has arrived,
or don't put anything here if you just want expired content to disappear
and nothing else to take it place.
<?php } else { ?>
content to display while the date and time hasn't arrived yet.
<?php } ?>

      

+3


source to share


1 answer


What you need is this <select>User please select your timezone</select>

(until +12 <> -12 and this option should select EVERY user who lands on your site, including you - for something like this.

The server has no idea on the IP - which user is in which zone if you are somehow not working.



You have to work with GMT time and develop a custom function to handle user input (timezone) for this.

0


source







All Articles