Example #1
0
 function GetList($search_data, $module, $opts)
 {
     try {
         $ivl = INTERVAL::ParseInterval($search_data);
     } catch (ADEIException $ae) {
         return false;
     }
     list($from, $to) = explode("-", $ivl);
     $title = date("M j, Y H:i:s", $from) . " - " . date("M j, Y H:i:s", $to);
     return array(array('title' => $title, 'props' => array('window' => $ivl), 'description' => false, 'certain' => true));
 }
Example #2
0
<?php

require "../../adei.php";
$unit_tests = array("2005" => "1104537600-1136073600", "2005-2007" => "1104537600-1199145600", "Dec, 2007" => "1196467200-1199145600", "Oct-november, 2007" => "1191196800-1196467200", "Nov. 25, 2007" => "1195948800-1196035200", "February 23 - 24, 2005" => "1109116800-1109289600", "21 Feb., 2003" => "1045785600-1045872000", "21 -24 Feb, 2003" => "1045785600-1046131200", "25 Feb, 2003" => "1046131200-1046217600", "2003, Feb - March" => "1044057600-1049155200", "2003, Feb." => "1044057600-1046476800", "2003, Feb. 24-25" => "1046044800-1046217600", "Feb 23, 2008  15:00 - 17:00" => "1203778800-1203786000", "Feb 23, 2008.  15 - 17" => "1203778800-1203786000", "Feb 23, 2008.  15 - 17" => "1203778800-1203786000", "2008, Feb 23;  15 - 17" => "1203778800-1203786000", "17:00:00 - 19:05:01 25 Feb, 2003" => "1046192400-1046199901", "Feb 23, 2008 + 1d" => "1203724800-1203811200", "Feb 23, 2008 + 30 min" => "1203724800-1203726600", "1203724800-1203726600" => "1203724800-1203726600", "1203724800.1-1203726600.3" => "1203724800.1-1203726600.3", "20080103T200000-20080503T203000" => "1199390400-1209846600", "Feb 23, 2008 - Mar 25, 2009" => "1203724800-1237939200");
#date_default_timezone_set("GMT");
foreach ($unit_tests as $var => $res) {
    $ivl = INTERVAL::ParseInterval($var);
    if (strcmp($ivl, $res)) {
        echo "Failed: {$var} => {$res}\n";
        echo "Got: {$ivl}\n";
        exit;
    }
}
echo "All tests passed\n";
exit;
$var = "February 23 - 24, 2005";
#$a = new DateInterval($var);
$a = new DateTime($var);
$ts = $a->format("U.u");
echo date("c", $ts);
Example #3
0
 public function __construct($value)
 {
     parent::__construct(INTERVAL::ParseInterval($value));
 }