function actionDefault()
 {
     YDDebugUtil::dump(YDDate::now(), 'YDDate::now()');
     YDDebugUtil::dump(YDDate::nowCustom("%d"), 'YDDate::nowCustom( "%d" )');
     YDDebugUtil::dump(YDDate::nowCustom("%d %B %Y"), 'YDDate::nowCustom( "%d %B %Y" )');
     // Static validation
     YDDebugUtil::dump(YDDate::get("HUM", time()), 'YDDate::get( "HUM", time() )');
     YDDebugUtil::dump(YDDate::get("EUN_DATE", time()), 'YDDate::get( "EUN_DATE", time() )');
     YDDebugUtil::dump(YDDate::get("HUM_DATE", "2004-03-12", "ISO"), 'YDDate::get( "HUM_DATE", "2004-03-12", "ISO" )');
     YDDebugUtil::dump(YDDate::now(), 'YDDate::now()');
     YDDebugUtil::dump(YDDate::now("EUN_DATE"), 'YDDate::now( "EUN_DATE" )');
     YDDebugUtil::dump(YDDate::now("ISO_TIME"), 'YDDate::now( "ISO_TIME" )');
     YDDebugUtil::dump(YDDate::now("HUM"), 'YDDate::now( "HUM" )');
     YDDebugUtil::dump(YDDate::isValid(""), 'YDDate::isValid( "" )');
     YDDebugUtil::dump(YDDate::isValid("0000-00-00 00:00:00", "ISO"), 'YDDate::isValid( "0000-00-00 00:00:00", "ISO" )');
     YDDebugUtil::dump(YDDate::isValid("0000-00-00 00:00:00", "ISO", true, false), 'YDDate::isValid( "0000-00-00 00:00:00", "ISO", true, false )');
     YDDebugUtil::dump(YDDate::isValid("2005-5-5"), 'YDDate::isValid( "2005-5-5" )');
     YDDebugUtil::dump(YDDate::isValid("2005 5 15"), 'YDDate::isValid( "2005 5 15" )');
     YDDebugUtil::dump(YDDate::isValid("20050515", "SQL"), 'YDDate::isValid( "20050515", "SQL" )');
     YDDebugUtil::dump(YDDate::isValid("15 5 2005", "EUN"), 'YDDate::isValid( "15 5 2005", "EUN" )');
     YDDebugUtil::dump(YDDate::isValid("15 May 2005", "HUM"), 'YDDate::isValid( "15 May 2005", "HUM" )');
     YDDebugUtil::dump(YDDate::isValid("5.15.2005", "USA"), 'YDDate::isValid( "5.15.2005", "USA" )');
     YDDebugUtil::dump(YDDate::isValid("5.15.2005", "EUN"), 'YDDate::isValid( "5.15.2005", "EUN" )');
     YDDebugUtil::dump(YDDate::isValid("5.15.2005", "HUM"), 'YDDate::isValid( "5.15.2005", "HUM" )');
     YDDebugUtil::dump(YDDate::isValid("5.15.2005", "ISO"), 'YDDate::isValid( "5.15.2005", "ISO" )');
     YDDebugUtil::dump(YDDate::isValid("5.15.2005", "SQL"), 'YDDate::isValid( "5.15.2005", "SQL" )');
     $date = new YDDate();
     // Setting an empty date
     $date->set("0000-00-00 00:00:00");
     YDDebugUtil::dump($date->get(), '$date->set( "0000-00-00 00:00:00" )');
     // Setting Unix epoch
     $date->set(0);
     YDDebugUtil::dump($date->get(), '$date->set( 0 )');
     // Setting in SQL format
     $date->set("20050515", "SQL");
     YDDebugUtil::dump($date->get(), '$date->set( "20050515", "SQL" )');
     // Setting in ISO format
     $date->set("2005-5-5");
     YDDebugUtil::dump($date->get(), '$date->set( "2005-5-15" )');
     $date->set("2005 5 15");
     YDDebugUtil::dump($date->get(), '$date->set( "2005 5 15" )');
     // Setting in EUN format
     $date->set("15 5 2005", "EUN");
     YDDebugUtil::dump($date->get(), '$date->set( "15 5 2005", "EUN" )');
     // Setting in HUM format
     $date->set("15 May 2005", "HUM");
     YDDebugUtil::dump($date->get(), '$date->set( "15 May 2005", "HUM" )');
     // Setting in USA format
     $date->set("5.15.2005", "USA");
     YDDebugUtil::dump($date->get(), '$date->set( "5.15.2005", "USA" )');
     // Setting a custom format
     YDDebugUtil::dump(YDDateFormat::setString("custom format", "%a %A %b %B %d %m %Y %H %M %S %T %w"), 'YDDateFormat::setString( "custom format", "%a %A %b %B %d %m %Y %H %M %S %T %w" )');
     // Returning the date with a custom format
     YDDebugUtil::dump($date->get("custom format"), '$date->get( "custom format" )');
     // Setting the date to today
     $date->set();
     YDDebugUtil::dump($date->get(), '$date->set()');
     // Getting date info
     YDDebugUtil::dump($date->get(), '$date->get()');
     YDDebugUtil::dump($date->isToday(), '$date->isToday()');
     YDDebugUtil::dump($date->isTomorrow(), '$date->isTomorrow()');
     YDDebugUtil::dump($date->isYesterday(), '$date->isYesterday()');
     YDDebugUtil::dump($date->isCurrentHour(), '$date->isCurrentHour()');
     YDDebugUtil::dump($date->isCurrentMinute(), '$date->isCurrentMinute()');
     YDDebugUtil::dump($date->isCurrentMonth(), '$date->isCurrentMonth()');
     YDDebugUtil::dump($date->isCurrentYear(), '$date->isCurrentYear()');
     YDDebugUtil::dump($date->getDayName(), '$date->getDayName()');
     YDDebugUtil::dump($date->getDayName(true), '$date->getDayName( true )');
     YDDebugUtil::dump($date->getMonthName(), '$date->getMonthName()');
     YDDebugUtil::dump($date->getMonthName(true), '$date->getMonthName( true )');
     // Getting date info with different locale
     YDDebugUtil::dump(YDLocale::set("ptb"), 'YDLocale::set( "ptb" )');
     YDDebugUtil::dump($date->getDayName(), '$date->getDayName()');
     YDDebugUtil::dump($date->getDayName(true), '$date->getDayName( true )');
     YDDebugUtil::dump($date->getMonthName(), '$date->getMonthName()');
     YDDebugUtil::dump($date->getMonthName(true), '$date->getMonthName( true )');
     // Comparing two dates
     $date2 = $date;
     $date2->addHour(10);
     $date2->addDay(35);
     YDDebugUtil::dump($date->get(), 'Date 1');
     YDDebugUtil::dump($date2->get(), 'Date 2');
     YDDebugUtil::dump($date->getDifference($date2), 'Difference between Dates 1 and 2');
     // Adding values
     YDDebugUtil::dump($date->get(), '$date->get()');
     YDDebugUtil::dump($date->addSecond(70), '$date->addSecond( 70 )');
     YDDebugUtil::dump($date->addMinute(80), '$date->addMinute( 80 )');
     YDDebugUtil::dump($date->addHour(24), '$date->addHour( 24 )');
     YDDebugUtil::dump($date->addHour(12), '$date->addHour( 12 )');
     YDDebugUtil::dump($date->addHour(-10), '$date->addHour( -10 )');
     YDDebugUtil::dump($date->addHour(-24), '$date->addHour( -24 )');
     YDDebugUtil::dump($date->addMinute(10), '$date->addMinute( 10 )');
     YDDebugUtil::dump($date->addMinute(60), '$date->addMinute( 60 )');
     YDDebugUtil::dump($date->addMinute(120), '$date->addMinute( 120 )');
     YDDebugUtil::dump($date->addMinute(-120), '$date->addMinute( -120 )');
     YDDebugUtil::dump($date->addMinute(360), '$date->addMinute( 360 )');
     YDDebugUtil::dump($date->addSecond(10), '$date->addSecond( 10 )');
     YDDebugUtil::dump($date->addSecond(60), '$date->addSecond( 60 )');
     YDDebugUtil::dump($date->addSecond(3600), '$date->addSecond( 3600 )');
     YDDebugUtil::dump($date->addSecond(), '$date->addSecond( -10 )');
     YDDebugUtil::dump($date->addDay(40), '$date->addDay( 40 )');
     YDDebugUtil::dump($date->addDay(-3), '$date->addDay( -3 )');
     YDDebugUtil::dump($date->addMonth(1), '$date->addMonth( 1 )');
     YDDebugUtil::dump($date->addMonth(12), '$date->addMonth( 12 )');
     YDDebugUtil::dump($date->addMonth(10), '$date->addMonth( 10 )');
     YDDebugUtil::dump($date->addMonth(-4), '$date->addMonth( -4 )');
     YDDebugUtil::dump($date->addMonth(-20), '$date->addMonth( -20 )');
     YDDebugUtil::dump($date->addYear(1), '$date->addYear( 1 )');
     YDDebugUtil::dump($date->addYear(12), '$date->addYear( 12 )');
     YDDebugUtil::dump($date->addYear(10), '$date->addYear( 10 )');
     YDDebugUtil::dump($date->addYear(-4), '$date->addYear( -4 )');
     YDDebugUtil::dump($date->addYear(-20), '$date->addYear( -20 )');
     // Getting an array
     YDDebugUtil::dump($date->toArray(), '$date->toArray()');
     $date->set("1981-11-20");
     YDDebugUtil::dump($date->get(), '$date->set( "1981-11-20" )');
     YDDebugUtil::dump($date->getYearsToToday(), '$date->getYearsToToday()');
     // Should return an error
     YDDebugUtil::dump($date->set("no_date"), '$date->set( "no_date" )');
 }
 /**
  *  This function returns a regex string of the format.
  *
  *  @param $format   The format name.
  *  @param $regexes  (Optional) Regexes replacements.
  *
  *  @returns     The regex string.
  *
  *  @static
  */
 function getRegex($format, $regexes = array())
 {
     $s = '([0-5]{1}[0-9]{1}|[0-9]{1})';
     // seconds and minutes
     $h = '([0-1]{1}[0-9]{1}|2[0-3]{1}|[0-9]{1})';
     // hours
     $d = '([0-2]{1}[0-9]{1}|30|31|[0-9]{1})';
     // day
     $m = '(0[0-9]{1}|1[0-2]{1}|[0-9]{1})';
     // month
     $y = '([0-9]{4})';
     // year 4 digits
     $t = '([\\-\\/\\.\\,\\: ])';
     // separators
     $a = '([a-zA-Z]+)';
     // alpha
     $w = '([0-9]+)';
     // numbers
     // replace regexes
     if ($regexes) {
         foreach ($regexes as $k => $v) {
             ${$k} = $v;
         }
     }
     // format string
     $string = YDDateFormat::get($format, 'string');
     // time representation
     $string = str_replace('%T', '%H:%M:%S', $string);
     // separators
     $string = preg_replace($t, $t, $string);
     // date
     $string = str_replace('%a', $a, $string);
     $string = str_replace('%A', $a, $string);
     $string = str_replace('%b', $a, $string);
     $string = str_replace('%B', $a, $string);
     $string = str_replace('%d', $d, $string);
     $string = str_replace('%m', $m, $string);
     $string = str_replace('%Y', $y, $string);
     $string = str_replace('%w', $w, $string);
     // time
     $string = str_replace('%H', $h, $string);
     $string = str_replace('%M', $s, $string);
     $string = str_replace('%S', $s, $string);
     return '/^' . $string . '$/i';
 }