Index: Date.php
===================================================================
RCS file: /repository/pear/Date/Date.php,v
retrieving revision 1.29
diff -u -r1.29 Date.php
--- Date.php 5 Jan 2005 20:20:56 -0000 1.29
+++ Date.php 14 Mar 2005 22:05:23 -0000
@@ -283,7 +283,9 @@
* %D same as "%m/%d/%y"
* %e day of month, single digit (range 0 to 31)
* %E number of days since unspecified epoch (integer, Date_Calc::dateToDays())
+ * %h hour as single digit decimal number (0 to 23)
* %H hour as decimal number (00 to 23)
+ * %i hour as single digit decimal number on 12-hour clock (1 to 12)
* %I hour as decimal number on 12-hour clock (01 to 12)
* %j day of year (range 001 to 366)
* %m month as decimal number (range 01 to 12)
@@ -341,14 +343,21 @@
$output .= sprintf("%02d/%02d/%02d",$this->month,$this->day,$this->year);
break;
case "e":
- $output .= $this->day * 1; // get rid of leading zero
+ $output .= intval($this->day); // get rid of leading zero
break;
case "E":
$output .= Date_Calc::dateToDays($this->day,$this->month,$this->year);
break;
+ case "h":
+ $output .= intval($this->hour);
+ break;
case "H":
$output .= sprintf("%02d", $this->hour);
break;
+ case "i":
+ $hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour;
+ $output .= intval($hour==0 ? 12 : $hour);
+ break;
case "I":
$hour = ($this->hour + 1) > 12 ? $this->hour - 12 : $this->hour;
$output .= sprintf("%02d", $hour==0 ? 12 : $hour);