CVS update: php3/functions
| From: | cmv | Date: | Wed, 02 Jun 1999 17:22:30 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6471@lists.php.net to get a copy of this message | ||
Date: Wednesday June 2, 1999 @ 13:22
Author: cmv
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv18552/functions
Modified Files:
datetime.c
Log Message:
added 't' to date() function ... days in the month (28 to 31)
Index: php3/functions/datetime.c
diff -u php3/functions/datetime.c:1.51 php3/functions/datetime.c:1.52
--- php3/functions/datetime.c:1.51 Fri Apr 2 19:55:40 1999
+++ php3/functions/datetime.c Wed Jun 2 13:22:30 1999
@@ -30,7 +30,7 @@
*/
-/* $Id: datetime.c,v 1.51 1999/04/03 00:55:40 sas Exp $ */
+/* $Id: datetime.c,v 1.52 1999/06/02 17:22:30 cmv Exp $ */
#ifdef THREAD_SAFE
@@ -76,6 +76,8 @@
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
+#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
+
/* {{{ proto int time(void)
Return current UNIX timestamp */
void php3_time(INTERNAL_FUNCTION_PARAMETERS)
@@ -223,6 +225,7 @@
case 'A': /* AM/PM */
case 'a': /* am/pm */
case 'S': /* standard english suffix for the day of the month (e.g. 3rd, 2nd, etc) */
+ case 't': /* days in current month */
size += 2;
break;
case '\\':
@@ -350,6 +353,10 @@
sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */
strcat(return_value->value.str.val, tmp_buff);
break;
+ case 't': /* days in current month */
+ sprintf(tmp_buff, "%2d", phpday_tab[isleap(ta->tm_year)][ta->tm_mon] );
+ strcat(return_value->value.str.val, tmp_buff);
+ break;
default:
length = strlen(return_value->value.str.val);
return_value->value.str.val[length] = format->value.str.val[i];
@@ -452,7 +459,6 @@
*/
/* {{{ proto bool checkdate(int month, int day, int year)
Validate a date/time */
-#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
void php3_checkdate(INTERNAL_FUNCTION_PARAMETERS)
{
pval *month, *day, *year;