Annotation of embedaddon/php/ext/standard/tests/time/strptime_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test strptime() function : basic functionality
! 3: --SKIPIF--
! 4: <?php
! 5: if (!function_exists('strptime')) {
! 6: die("skip - strptime() function not available in this build");
! 7: }
! 8: ?>
! 9:
! 10: --FILE--
! 11: <?php
! 12: /* Prototype : array strptime ( string $date , string $format )
! 13: * Description: Parse a time/date generated with strftime()
! 14: * Source code: ext/standard/datetime.c
! 15: */
! 16:
! 17: $orig = setlocale(LC_ALL, 'C');
! 18: date_default_timezone_set("GMT");
! 19:
! 20: echo "*** Testing strptime() : basic functionality ***\n";
! 21:
! 22: $input = "10:00:00 AM July 2 1963";
! 23: $tstamp = strtotime($input);
! 24:
! 25: $str = strftime("%r %B%e %Y %Z", $tstamp);
! 26: var_dump(strptime($str, '%H:%M:%S %p %B %d %Y %Z'));
! 27:
! 28: $str = strftime("%T %D", $tstamp);
! 29: var_dump(strptime($str, '%H:%M:%S %m/%d/%y'));
! 30:
! 31: $str = strftime("%A %B %e %R", $tstamp);
! 32: var_dump(strptime($str, '%A %B %e %R'));
! 33:
! 34: setlocale(LC_ALL, $orig);
! 35: ?>
! 36: ===DONE===
! 37: --EXPECTF--
! 38: *** Testing strptime() : basic functionality ***
! 39: array(9) {
! 40: ["tm_sec"]=>
! 41: int(0)
! 42: ["tm_min"]=>
! 43: int(0)
! 44: ["tm_hour"]=>
! 45: int(10)
! 46: ["tm_mday"]=>
! 47: int(2)
! 48: ["tm_mon"]=>
! 49: int(6)
! 50: ["tm_year"]=>
! 51: int(63)
! 52: ["tm_wday"]=>
! 53: int(2)
! 54: ["tm_yday"]=>
! 55: int(182)
! 56: ["unparsed"]=>
! 57: string(3) "GMT"
! 58: }
! 59: array(9) {
! 60: ["tm_sec"]=>
! 61: int(0)
! 62: ["tm_min"]=>
! 63: int(0)
! 64: ["tm_hour"]=>
! 65: int(10)
! 66: ["tm_mday"]=>
! 67: int(2)
! 68: ["tm_mon"]=>
! 69: int(6)
! 70: ["tm_year"]=>
! 71: int(163)
! 72: ["tm_wday"]=>
! 73: int(1)
! 74: ["tm_yday"]=>
! 75: int(182)
! 76: ["unparsed"]=>
! 77: string(0) ""
! 78: }
! 79: array(9) {
! 80: ["tm_sec"]=>
! 81: int(0)
! 82: ["tm_min"]=>
! 83: int(0)
! 84: ["tm_hour"]=>
! 85: int(10)
! 86: ["tm_mday"]=>
! 87: int(2)
! 88: ["tm_mon"]=>
! 89: int(6)
! 90: ["tm_year"]=>
! 91: int(0)
! 92: ["tm_wday"]=>
! 93: int(2)
! 94: ["tm_yday"]=>
! 95: int(182)
! 96: ["unparsed"]=>
! 97: string(0) ""
! 98: }
! 99: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>