Annotation of embedaddon/php/ext/date/tests/date_period.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DatePeriod
! 3: --FILE--
! 4: <?php
! 5: date_default_timezone_set('UTC');
! 6: $db = new DateTime( '2008-01-01' );
! 7: $de = new DateTime( '2008-12-31' );
! 8: $di = DateInterval::createFromDateString( 'first day of next month' );
! 9:
! 10: foreach ( new DatePeriod( $db, $di, $de ) as $dt )
! 11: {
! 12: echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
! 13: }
! 14: ?>
! 15:
! 16: <?php
! 17: $db = new DateTime( '2007-12-31' );
! 18: $de = new DateTime( '2009-12-31 23:59:59' );
! 19: $di = DateInterval::createFromDateString( 'last thursday of next month' );
! 20:
! 21: foreach ( new DatePeriod( $db, $di, $de, DatePeriod::EXCLUDE_START_DATE ) as $dt )
! 22: {
! 23: echo $dt->format( "l Y-m-d H:i:s\n" );
! 24: }
! 25: ?>
! 26: --EXPECT--
! 27: Tuesday 2008-01-15
! 28: Tuesday 2008-02-19
! 29: Tuesday 2008-03-18
! 30: Tuesday 2008-04-15
! 31: Tuesday 2008-05-20
! 32: Tuesday 2008-06-17
! 33: Tuesday 2008-07-15
! 34: Tuesday 2008-08-19
! 35: Tuesday 2008-09-16
! 36: Tuesday 2008-10-21
! 37: Tuesday 2008-11-18
! 38: Tuesday 2008-12-16
! 39:
! 40: Thursday 2008-01-31 00:00:00
! 41: Thursday 2008-02-28 00:00:00
! 42: Thursday 2008-03-27 00:00:00
! 43: Thursday 2008-04-24 00:00:00
! 44: Thursday 2008-05-29 00:00:00
! 45: Thursday 2008-06-26 00:00:00
! 46: Thursday 2008-07-31 00:00:00
! 47: Thursday 2008-08-28 00:00:00
! 48: Thursday 2008-09-25 00:00:00
! 49: Thursday 2008-10-30 00:00:00
! 50: Thursday 2008-11-27 00:00:00
! 51: Thursday 2008-12-25 00:00:00
! 52: Thursday 2009-01-29 00:00:00
! 53: Thursday 2009-02-26 00:00:00
! 54: Thursday 2009-03-26 00:00:00
! 55: Thursday 2009-04-30 00:00:00
! 56: Thursday 2009-05-28 00:00:00
! 57: Thursday 2009-06-25 00:00:00
! 58: Thursday 2009-07-30 00:00:00
! 59: Thursday 2009-08-27 00:00:00
! 60: Thursday 2009-09-24 00:00:00
! 61: Thursday 2009-10-29 00:00:00
! 62: Thursday 2009-11-26 00:00:00
! 63: Thursday 2009-12-31 00:00:00
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>