cvs: /php4/ext/standard datetime.c
| From: | Andrey Zmievski | Date: | Tue, 20 Jul 1999 12:59:31 +0000 |
| Subject: | cvs: /php4/ext/standard datetime.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-2305@lists.php.net to get a copy of this message | ||
andrey Tue Jul 20 12:59:31 1999 EDT
Modified files:
/php4/ext/standard datetime.c
Log:
Fix for bug #1750.
Index: php4/ext/standard/datetime.c
diff -u php4/ext/standard/datetime.c:1.10 php4/ext/standard/datetime.c:1.11
--- php4/ext/standard/datetime.c:1.10 Fri Jul 16 09:12:55 1999
+++ php4/ext/standard/datetime.c Tue Jul 20 12:59:30 1999
@@ -19,7 +19,7 @@
*/
-/* $Id: datetime.c,v 1.10 1999/07/16 13:12:55 zeev Exp $ */
+/* $Id: datetime.c,v 1.11 1999/07/20 16:59:30 andrey Exp $ */
#include "php.h"
@@ -197,6 +197,8 @@
case 'j': /* day of the month, numeric, no leading zeros */
case 'H': /* hour, numeric, 24 hour format */
case 'h': /* hour, numeric, 12 hour format */
+ case 'G': /* hour, numeric, 24 hour format, no leading zeroes */
+ case 'g': /* hour, numeric, 12 hour format, no leading zeroes */
case 'i': /* minutes, numeric */
case 's': /* seconds, numeric */
case 'A': /* AM/PM */
@@ -276,6 +278,15 @@
case 'h': /* hour, numeric, 12 hour format */
h = ta->tm_hour % 12; if (h==0) h = 12;
sprintf(tmp_buff, "%02d", h); /* SAFE */
+ strcat(return_value->value.str.val, tmp_buff);
+ break;
+ case 'G': /* hour, numeric, 24 hour format, no leading zeros */
+ sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */
+ strcat(return_value->value.str.val, tmp_buff);
+ break;
+ case 'g': /* hour, numeric, 12 hour format, no leading zeros */
+ h = ta->tm_hour % 12; if (h==0) h = 12;
+ sprintf(tmp_buff, "%d", h); /* SAFE */
strcat(return_value->value.str.val, tmp_buff);
break;
case 'i': /* minutes, numeric */