コード例 #1
0
 public static function getNumericDate($date, $format)
 {
     $day = "";
     $month = "";
     $year = "";
     if (!DateUtils::parseDate($date, $format, $day, $month, $year)) {
         return false;
     }
     return intval(str_pad($year, 4, '0', STR_PAD_LEFT) . str_pad($year, 2, '0', STR_PAD_LEFT) . str_pad($year, 2, '0', STR_PAD_LEFT));
 }
コード例 #2
0
 /**
  * @covers DateUtils::parseDate
  */
 public function testParseDate()
 {
     $actual = \DateUtils::parseDate("2015-05-01 10:34:23", "Europe/Paris");
     $excepted = 1430469263;
     $this->assertEquals($excepted, $actual);
 }