#!/usr/bin/php -q
<?php
$time = time( );
Echo "Current UNIX time: $time\n";
$date = date("F j, Y, g:i a I");
Echo "Current date/time: $date\n\n";
# Using times before and after change from Standard Time to DST
$time_1 = 1299965601;
$time_2 = $time_1 + 86400;
$before_dt = date("F j, Y, g:i a I",$time_1);
Echo "A time on day before DST starts: $before_dt\n";
$after_dt = date("F j, Y, g:i a I",$time_2);
Echo "A time exactly 24 hours after the previous time: $after_dt\n";
$DST_correction = (date("I",$time_1) - date("I",$time_2)) * 3600;
Echo "DST correction that should be applied: $DST_correction\n";
$adjusted_time = date("F j, Y, g:i a I",$time_2 + $DST_correction);
Echo "Time adjusted with DST correction: $adjusted_time\n\n";
# Using times before and after change from DST back to Standard Time
$time_1 = 1320528801;
$time_2 = $time_1 + 86400;
$before_dt = date("F j, Y, g:i a I",$time_1);
Echo "A time on day before DST ends: $before_dt\n";
$after_dt = date("F j, Y, g:i a I",$time_2);
Echo "A time exactly 24 hours after the previous time: $after_dt\n";
$DST_correction = (date("I",$time_1) - date("I",$time_2)) * 3600;
Echo "DST correction that should be applied: $DST_correction\n";
$adjusted_time = date("F j, Y, g:i a I",$time_2 + $DST_correction);
Echo "Time adjusted with DST correction: $adjusted_time\n\n";