How do I redirect URL based on the time of day in London. I've seen methods of doing it with javascript that uses the local machine time and other methods using PHP that uses the server location time. With the PHP method the server has to be set in London time in order for that to work but I have no access to that. Is there a way to do a redirect that follows the time of day in London no matter where the client is in the world?
Asked
Active
Viewed 426 times
0
-
Use UTC time and then London's offset (usually 0, 1 during DST). – Scimonster Jun 17 '14 at 18:43
-
http://stackoverflow.com/questions/8655515/get-utc-time-in-php – Unlink Jun 17 '14 at 18:45
2 Answers
0
You can use
$_SERVER['REQUEST_TIME'];
It will return the current UNIX Timestamp.
http://ch1.php.net/manual/en/function.time.php
This is the manual page from the php docs

flightsearch
- 79
- 2
- 10
0
Try something like this:
<?php date_default_timezone_set('Europe/London');
$time = date("H");
if($time<12){
header("Location: siteerly.php");
exit();
}
else{
header("Location: siteelse.php");
exit();
}
You can modify it as you like. Remember to put this code before you output any html code.

Sebastian Td
- 174
- 1
- 7