Annotation of embedaddon/php/ext/date/tests/gmdate_variation9.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test gmdate() function : usage variation - Passing Time format options to format argument.
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string gmdate(string format [, long timestamp])
                      6:  * Description: Format a GMT date/time 
                      7:  * Source code: ext/date/php_date.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: echo "*** Testing gmdate() : usage variation ***\n";
                     12: 
                     13: // Initialise all required variables
                     14: date_default_timezone_set('UTC');
                     15: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
                     16: 
                     17: $time_formats = array(
                     18: 
                     19:       'Lowercase Ante meridiem and post meridiem' => 'a',
                     20:          'Uppercase Ante meridiem and post meridiem' => 'a',
                     21:          'Swatch Internet time' => 'B',
                     22:          '12-hour format without leading zeros' => 'g',
                     23:          '24-hour format without leading zeros' => 'G',
                     24:          '12-hour format with leading zeros' => 'h',
                     25:          '24-hour format with leading zeros' => 'H',
                     26:          'Minutes with leading zeros' => 'i',
                     27:          'Seconds with leading zeros' => 's',
                     28:          'Milliseconds' => 'u',
                     29: );
                     30: 
                     31: foreach($time_formats as $key =>$value) {
                     32:       echo "\n--$key--\n";
                     33:          var_dump( gmdate($value) );
                     34:          var_dump( gmdate($value, $timestamp) );
                     35: }        
                     36: 
                     37: ?>
                     38: ===DONE===
                     39: --EXPECTF--
                     40: *** Testing gmdate() : usage variation ***
                     41: 
                     42: --Lowercase Ante meridiem and post meridiem--
                     43: string(2) "%s"
                     44: string(2) "am"
                     45: 
                     46: --Uppercase Ante meridiem and post meridiem--
                     47: string(2) "%s"
                     48: string(2) "am"
                     49: 
                     50: --Swatch Internet time--
                     51: string(%d) "%d"
                     52: string(3) "380"
                     53: 
                     54: --12-hour format without leading zeros--
                     55: string(%d) "%d"
                     56: string(1) "8"
                     57: 
                     58: --24-hour format without leading zeros--
                     59: string(%d) "%d"
                     60: string(1) "8"
                     61: 
                     62: --12-hour format with leading zeros--
                     63: string(%d) "%d"
                     64: string(2) "08"
                     65: 
                     66: --24-hour format with leading zeros--
                     67: string(2) "%d"
                     68: string(2) "08"
                     69: 
                     70: --Minutes with leading zeros--
                     71: string(2) "%d"
                     72: string(2) "08"
                     73: 
                     74: --Seconds with leading zeros--
                     75: string(2) "%d"
                     76: string(2) "08"
                     77: 
                     78: --Milliseconds--
                     79: string(%d) "%d"
                     80: string(6) "000000"
                     81: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>