cvs: /php4 ChangeLog.TODO /php4/ext/standard datetime.c
| From: | Andrey Zmievski | Date: | Tue, 20 Jul 1999 15:11:32 +0000 |
| Subject: | cvs: /php4 ChangeLog.TODO /php4/ext/standard datetime.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-2333@lists.php.net to get a copy of this message | ||
andrey Tue Jul 20 15:11:32 1999 EDT
Modified files:
/php4 ChangeLog.TODO
/php4/ext/standard datetime.c
Log:
Added 'n' option to date().
Index: php4/ChangeLog.TODO
diff -u php4/ChangeLog.TODO:1.8 php4/ChangeLog.TODO:1.9
--- php4/ChangeLog.TODO:1.8 Mon Jul 12 10:19:27 1999
+++ php4/ChangeLog.TODO Tue Jul 20 15:11:31 1999
@@ -15,10 +15,6 @@
- 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: php4/ext/standard/datetime.c
diff -u php4/ext/standard/datetime.c:1.11 php4/ext/standard/datetime.c:1.12
--- php4/ext/standard/datetime.c:1.11 Tue Jul 20 12:59:30 1999
+++ php4/ext/standard/datetime.c Tue Jul 20 15:11:32 1999
@@ -19,7 +19,7 @@
*/
-/* $Id: datetime.c,v 1.11 1999/07/20 16:59:30 andrey Exp $ */
+/* $Id: datetime.c,v 1.12 1999/07/20 19:11:32 andrey Exp $ */
#include "php.h"
@@ -193,6 +193,7 @@
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 */
@@ -261,6 +262,10 @@
break;
case 'm': /* month, numeric */
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 */