示例#1
0
文件: NDate.php 项目: anas/feedstore
 static function test()
 {
     $a = new NDate("12:30am");
     $b = new NDate(array('h' => 12, 'i' => 30, 'a' => 'am'));
     error_log("TESTING STARTED");
     // test2(a,b)   calls NDate(a) and NDate(b) and checks for equality
     // test2(a,b,c) calls NDate(a) and NDate(b,c)
     // test2(a,b,c,d) calls NDate(a) and NDate(b,c,d)
     NDate::test2("12:30am", array('h' => 12, 'i' => 30, 'a' => 'am'));
     NDate::test2("12:30pm", array('h' => 12, 'i' => 30, 'a' => 'pm'));
     NDate::test2("12:00AM", array('h' => 12, 'i' => 0, 'a' => 'AM'));
     NDate::test2("12:00PM", array('h' => 12, 'i' => 0, 'A' => 'PM'));
     NDate::test2("12:00pm", array('h' => 12, 'i' => 0, 'a' => 'pm'));
     NDate::test2("11:55am", array('h' => 11, 'i' => 55, 'a' => 'am'));
     NDate::test2("11:55pm", array('h' => 11, 'i' => 55, 'a' => 'pm'));
     NDate::test2("Sep 2, 2008 noon", "yesterday noon", "Sep 3, 2008");
     NDate::test2("Sep 1, 2008", "1st", "Sep 20, 2008");
     NDate::test2("Sep 30, 2008", "last", "Sep 20, 2008");
     NDate::test2("Sep 1, 2008 3:35pm", "3:35pm", "1st", "Sep 20, 2008");
     error_log("TESTING DONE");
 }