From: Andrey Hristov Date: Tue, 20 Jul 1999 16:59:30 +0000 (+0000) Subject: Fix for bug #1750. X-Git-Tag: php-4.0b1~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8fdee1c66db32db3af4a3af321938d59a69ef4f;p=php Fix for bug #1750. --- diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 9be3bc80ae..4b19f459e9 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -197,6 +197,8 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) 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 */ @@ -278,6 +280,15 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) 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 */ sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */ strcat(return_value->value.str.val, tmp_buff);