[PHP-DEV] CVS update: php3/functions From: cmv (php-dev <email protected>)
Date: 03/29/99

Date: Monday March 29, 1999 @ 14:54
Author: cmv

Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv6226/functions

Modified Files:
        datetime.c
Log Message:
additions to date():
- 'g' - hour, 1-12, no leading zeros
- 'G' - hour, 0-23, no leading zeros
- 'n' - month, 1-12, no leading zeros

Index: php3/functions/datetime.c
diff -c php3/functions/datetime.c:1.49 php3/functions/datetime.c:1.50
*** php3/functions/datetime.c:1.49 Sat Mar 13 08:57:02 1999
--- php3/functions/datetime.c Mon Mar 29 14:54:45 1999
***************
*** 30,36 ****
   */
  
  
! /* $Id: datetime.c,v 1.49 1999/03/13 13:57:02 sas Exp $ */
  
  
  #ifdef THREAD_SAFE
--- 30,36 ----
   */
  
  
! /* $Id: datetime.c,v 1.50 1999/03/29 19:54:45 cmv Exp $ */
  
  
  #ifdef THREAD_SAFE
***************
*** 213,218 ****
--- 213,219 ----
                                  break;
                          case 'y': /* year, numeric, 2 digits */
                          case 'm': /* month, numeric */
+ case 'n': /* month, numeric, no leading zeros */
                          case 'd': /* day of the month, numeric */
                          case 'j': /* day of the month, numeric, no leading zeros */
                          case 'H': /* hour, numeric, 24 hour format */
***************
*** 281,291 ****
                                  sprintf(tmp_buff, "%02d", 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);
                                  break;
! case 'j':
                                  sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
                                  strcat(return_value->value.str.val, tmp_buff);
                                  break;
--- 282,296 ----
                                  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);
                                  break;
! case 'j': /* day of the month, numeric, no leading zeros */
                                  sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
                                  strcat(return_value->value.str.val, tmp_buff);
                                  break;
***************
*** 296,301 ****
--- 301,315 ----
                          case 'h': /* hour, numeric, 12 hour format */
                                  h = ta->tm_hour % 12; if (h==0) h = 12;
                                  sprintf(tmp_buff, "%02d", h); /* SAFE */
+ strcat(return_value->value.str.val, tmp_buff);
+ break;
+ case 'G': /* hour, numeric, 24 hour format, no leading zeros */
+ sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */
+ strcat(return_value->value.str.val, tmp_buff);
+ break;
+ case 'g': /* hour, numeric, 12 hour format, no leading zeros */
+ h = ta->tm_hour % 12; if (h==0) h = 12;
+ sprintf(tmp_buff, "%d", h); /* SAFE */
                                  strcat(return_value->value.str.val, tmp_buff);
                                  break;
                          case 'i': /* minutes, numeric */

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>