date.test 632B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. "date" function
  3. --TEMPLATE--
  4. {{ date() == date('now') ? 'OK' : 'KO' }}
  5. {{ date() > date('-1day') ? 'OK' : 'KO' }}
  6. {{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
  7. {{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
  8. {{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
  9. {{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
  10. --DATA--
  11. date_default_timezone_set('UTC');
  12. return array(
  13. 'date1' => mktime(13, 45, 0, 10, 4, 2010),
  14. 'date2' => new DateTime('2010-10-04 13:45'),
  15. 'date3' => '2010-10-04 13:45',
  16. 'date4' => 1286199900,
  17. 'date5' => -86410,
  18. )
  19. --EXPECT--
  20. OK
  21. OK
  22. OK
  23. OK
  24. OK
  25. OK