]> granicus.if.org Git - php/commitdiff
Added 'n' option to date().
authorAndrey Hristov <andrey@php.net>
Tue, 20 Jul 1999 19:11:32 +0000 (19:11 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 20 Jul 1999 19:11:32 +0000 (19:11 +0000)
ChangeLog.TODO
ext/standard/datetime.c

index 864375cb54a41fd350ff86c4660002f39e082d57..413b1ff765ee03b9c371aedaaa69a4d0f6f351a5 100644 (file)
@@ -15,10 +15,6 @@ over to PHP4.
 - PUT method support (mlemos@acm.org)
 - Fix parameter count problem in odbc_setoption()
 - Really fix implode() this time.  The fix in 3.0.7 was bogus
-- Added more option to the date() function: (Colin Viebrock)
-  'g' - hour, 12-hour format, no leading zeros
-  'G' - hour, 24-hour format, no leading zeros
-  'n' - month, numeric, no leading zeros
 - Make fgetss() slightly smarter
 - Add strip_tags() which uses the fgetss state-machine but acts on a string
 
index 4b19f459e9029ef032111118a2666da6cc842bc5..41f6765362b4694db3a368ece097584aa8183ad9 100644 (file)
@@ -193,6 +193,7 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
                                break;
                        case 'y':               /* year, numeric, 2 digits */
                        case 'm':               /* month, numeric */
+                       case 'n':               /* month, numeric, no leading zeroes */
                        case 'd':               /* day of the month, numeric */
                        case 'j':               /* day of the month, numeric, no leading zeros */
                        case 'H':               /* hour, numeric, 24 hour format */
@@ -263,6 +264,10 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
                                sprintf(tmp_buff, "%02d", ta->tm_mon + 1);  /* SAFE */
                                strcat(return_value->value.str.val, tmp_buff);
                                break;
+                       case 'n':      /* month, numeric, no leading zeros */
+                               sprintf(tmp_buff, "%d", ta->tm_mon + 1);  /* SAFE */
+                               strcat(return_value->value.str.val, tmp_buff);
+                               break;
                        case 'd':               /* day of the month, numeric */
                                sprintf(tmp_buff, "%02d", ta->tm_mday);  /* SAFE */
                                strcat(return_value->value.str.val, tmp_buff);