summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>1999-07-20 19:11:32 +0000
committerAndrey Hristov <andrey@php.net>1999-07-20 19:11:32 +0000
commit3ff606a9341143c2e8fc05d4a64a86fbcaa97b16 (patch)
treed5050f9852f173a2f77b7f997df70f5c62af9c5d
parentacb9cae36dd0190d935f62ed87ba63c619c631aa (diff)
downloadphp-git-3ff606a9341143c2e8fc05d4a64a86fbcaa97b16.tar.gz
Added 'n' option to date().
-rw-r--r--ChangeLog.TODO4
-rw-r--r--ext/standard/datetime.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/ChangeLog.TODO b/ChangeLog.TODO
index 864375cb54..413b1ff765 100644
--- a/ChangeLog.TODO
+++ b/ChangeLog.TODO
@@ -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
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 4b19f459e9..41f6765362 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -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);