[time-nuts] small multi-timezone display

Didier Juges shalimr9 at gmail.com
Sat Jan 9 20:59:02 UTC 2021


For the curious, and if anyone wants to make it pretty, have a ball:

<?php
//$tz1 = "Europe/London";
$timestamp = time();

$tzs = explode(",", $_GET["tz"]);
$out_str="";
foreach( $tzs as $tz ){
  //echo $tz . "<p>\n";
  $dt = new DateTime( "now", new DateTimeZone( $tz )); //first argument
"must" be a string
  $dt->setTimestamp( $timestamp ); //adjust the object to correct timestamp
  $out_str .= $tz . ": " . $dt->format('d.m.Y, H:i:s') . "<p>\n";
}
//echo $dt->format('d.m.Y, H:i:s');
$sec=1;
?>
<html>
    <head>
    <meta http-equiv="refresh" content="<?php echo $sec?>">
    </head>
    <body>
    <?php
      echo $out_str;
    ?>
    </body>
</html>

On Sat, Jan 9, 2021 at 2:52 PM Didier Juges <shalimr9 at gmail.com> wrote:

> Mindlessly inspired by this thread, here the cheapest solution you could
> get (I believe):
>
> 1)  Buy a pre-paid Android phone for about $30 ($20 when they are on
> sale). They have a surprising amount of functionality for about as much
> money as a middle of the road Raspberry Pi.
> 2) Point the browser to
> http://ko4bb.com/utils/time.php?tz=America/Chicago,America/Los_Angeles,Europe/Paris
> (you can replace the time zone with your favorite, put more or fewer
> (separate with a comma) and you are on your way.
>
> Please note that
> 1) This is not very energy efficient as it will automatically refresh the
> page every second, and it will occasionally skip a second.
> 2) It is not pretty, I spent about 0 seconds on the formatting...
> But it is cheap :)
>
> Didier KO4BB
>
>
> On Fri, Jan 8, 2021 at 4:22 PM Jim Harman <j99harman at gmail.com> wrote:
>
>> ClockSync is a nice Android NTP app, which displays NTP time and system
>> time and can sync the system time to NTP if you have root access.
>>
>> Phones may need to be rooted for this to work. The ClockSync FAQ has a
>> good
>> explanation of these issues.
>>
>>
>> > --Jim Harman
>> _______________________________________________
>> time-nuts mailing list -- time-nuts at lists.febo.com
>> To unsubscribe, go to
>> http://lists.febo.com/mailman/listinfo/time-nuts_lists.febo.com
>> and follow the instructions there.
>>
>



More information about the Time-nuts_lists.febo.com mailing list