@@ -197,6 +197,8 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
197
197
case 'j' : /* day of the month, numeric, no leading zeros */
198
198
case 'H' : /* hour, numeric, 24 hour format */
199
199
case 'h' : /* hour, numeric, 12 hour format */
200
+ case 'G' : /* hour, numeric, 24 hour format, no leading zeroes */
201
+ case 'g' : /* hour, numeric, 12 hour format, no leading zeroes */
200
202
case 'i' : /* minutes, numeric */
201
203
case 's' : /* seconds, numeric */
202
204
case 'A' : /* AM/PM */
@@ -278,6 +280,15 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
278
280
sprintf (tmp_buff , "%02d" , h ); /* SAFE */
279
281
strcat (return_value -> value .str .val , tmp_buff );
280
282
break ;
283
+ case 'G' : /* hour, numeric, 24 hour format, no leading zeros */
284
+ sprintf (tmp_buff , "%d" , ta -> tm_hour ); /* SAFE */
285
+ strcat (return_value -> value .str .val , tmp_buff );
286
+ break ;
287
+ case 'g' : /* hour, numeric, 12 hour format, no leading zeros */
288
+ h = ta -> tm_hour % 12 ; if (h == 0 ) h = 12 ;
289
+ sprintf (tmp_buff , "%d" , h ); /* SAFE */
290
+ strcat (return_value -> value .str .val , tmp_buff );
291
+ break ;
281
292
case 'i' : /* minutes, numeric */
282
293
sprintf (tmp_buff , "%02d" , ta -> tm_min ); /* SAFE */
283
294
strcat (return_value -> value .str .val , tmp_buff );
0 commit comments