Annotation of embedaddon/php/ext/date/tests/date_isodate_set_basic1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test date_isodate_set() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] )
6: * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
7: * Source code: ext/date/php_date.c
8: * Alias to functions: DateTime::setISODate
9: */
10:
11: echo "*** Testing date_isodate_set() : basic functionality ***\n";
12:
13: //Set the default time zone
14: date_default_timezone_set("Europe/London");
15:
16: // Create a deate object
17: $datetime = date_create("2009-01-30 17:57:32");
18:
19: // Which month is week 40 ?
20: date_isodate_set($datetime, 2008, 40);
21: echo "Week 40 of 2009 is in \"" . date_format($datetime, "F") . "\"\n";
22:
23: // What date is week week 30 day 3 ?
24: date_isodate_set($datetime, 2009, 30, 3);
25: echo "Week 30 day 3 of 2009 is \"" . date_format($datetime, "D M j") . "\"\n";
26:
27: // What date was is last year ?
28: date_isodate_set($datetime, 2008, 30, 3);
29: echo "..same day last year was \"" . date_format($datetime, "D M j") . "\"\n";
30:
31: ?>
32: ===DONE===
33: --EXPECTF--
34: *** Testing date_isodate_set() : basic functionality ***
35: Week 40 of 2009 is in "September"
36: Week 30 day 3 of 2009 is "Wed Jul 22"
37: ..same day last year was "Wed Jul 23"
38: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>