tzphp

tzphp is a small php library using data from the Olson timezone database. The tz_localtime() function, acts like that of the localtime() php function. Two arguments are passed to tz_localtime(), a time, and a timezone name from the Olson database. The returned array is NOT associative. The array entries are as follows:

0 - seconds
1 - minutes
2 - hour
3 - day of the month
4 - month of the year, starting with 0 for January
5 - Years since 1900
6 - Day of the week
7 - Day of the year
9 - Is daylight savings time in effect

Example

<?php
  include('tz.php');
  $rtime = tz_localtime(time(), "America/Chicago");
  echo sprintf("%02d/%02d/%d %02d:%02d:%02d\n",
    $rtime[4]+1, $rtime[3], $rtime[5]+1900, $rtime[2], $rtime[1], $rtime[0]);
?>

Files

tzphp 0.1.0 13k Initial release.
tzphp 0.1.1 13k Fixed tz_gmtime to account for DST in local timezone. Set dst entry (9) in returned array. Updated example.php to show if zone is in DST. Corrected error in documention. (isdst index is 9 not 8)
tzphp 0.1.2 13k Fixed tz_days_in_month returning incorrect value for march
tzphp 0.1.3 13k Updated for new DST rules