private function _parseDate ($fmt, $fmtValue)
    {
        $y = 0;
        $m = 0;
        $d = 0;
        $hr = 0;
        $min = 0;
        $sec = 0;
        $a = preg_split("/\W+/", $fmtValue);
        preg_match_all("/%./", $fmt, $b);
        for ($i = 0; $i < count($a); ++ $i)
        {
            if (!$a[$i]) {
                continue;
            }
            switch ($b[0][$i])
            {
                case "%d": // the day of the month ( 00 .. 31 )
                case "%e": // the day of the month ( 0 .. 31 )
                    $d = intval($a[$i], 10);
                    break;
                case "%m": // month ( 01 .. 12 )
                    $m = intval($a[$i], 10);
                    break;
                case "%Y": // year including the century ( ex. 1979 )
                case "%y": // year without the century ( 00 .. 99 )
                    $y = intval($a[$i], 10);
                    if ($y < 100) {
                        $y += ($y > 29) ? 1900 : 2000;
                    }
                    break;
                case "%H": // hour ( 00 .. 23 )
                case "%I": // hour ( 01 .. 12 )
                case "%k": // hour ( 00 .. 23 )
                case "%l": // hour ( 01 .. 12 )
                    $hr = intval($a[$i], 10);
                    break;
                case "%P": // PM or AM
                case "%p": // pm or am
                    if ($a[$i] == 'pm' && $hr < 12) {
                        $hr += 12;
                    } else
                    if ($a[$i] == 'am' && $hr >= 12) {
                        $hr -= 12;
                    }
                    break;
                case "%M": // minute ( 00 .. 59 )
                    $min = intval($a[$i], 10);
                    break;
                case "%S": // second ( 00 .. 59 )
                    $sec = intval($a[$i], 10);
                    break;
                //default:
            }
        }
        $timeStamp = mktime($hr, $min, $sec, $m, $d, $y);
        return $timeStamp;
    }
private function _parseDate ($fmt, $fmtValue)
    {
        $y = 0;
        $m = 0;
        $d = 0;
        $hr = 0;
        $min = 0;
        $sec = 0;
        $a = preg_split("/\W+/", $fmtValue);
        preg_match_all("/%./", $fmt, $b);
        for ($i = 0; $i < count($a); ++ $i)
        {
            if (!$a[$i]) {
                continue;
            }
            switch ($b[0][$i])
            {
                case "%d": // the day of the month ( 00 .. 31 )
                case "%e": // the day of the month ( 0 .. 31 )
                    $d = intval($a[$i], 10);
                    break;
                case "%m": // month ( 01 .. 12 )
                    $m = intval($a[$i], 10);
                    break;
                case "%Y": // year including the century ( ex. 1979 )
                case "%y": // year without the century ( 00 .. 99 )
                    $y = intval($a[$i], 10);
                    if ($y < 100) {
                        $y += ($y > 29) ? 1900 : 2000;
                    }
                    break;
                case "%H": // hour ( 00 .. 23 )
                case "%I": // hour ( 01 .. 12 )
                case "%k": // hour ( 00 .. 23 )
                case "%l": // hour ( 01 .. 12 )
                    $hr = intval($a[$i], 10);
                    break;
                case "%P": // PM or AM
                case "%p": // pm or am
                    if ($a[$i] == 'pm' && $hr < 12) {
                        $hr += 12;
                    } else
                    if ($a[$i] == 'am' && $hr >= 12) {
                        $hr -= 12;
                    }
                    break;
                case "%M": // minute ( 00 .. 59 )
                    $min = intval($a[$i], 10);
                    break;
                case "%S": // second ( 00 .. 59 )
                    $sec = intval($a[$i], 10);
                    break;
                //default:
            }
        }
        $timeStamp = mktime($hr, $min, $sec, $m, $d, $y);
        return $timeStamp;
    }
private function _parseDate ( $ fmt , $ fmtValue ) { $ y = 0 ; $ m = 0 ; $ d = 0 ; $ hr = 0 ; $ min = 0 ; $ sec = 0 ; $ a = preg_split ( "/\W+/" , $ fmtValue ) ; preg_match_all ( "/%./" , $ fmt , $ b ) ; for ( $ i = 0 ; $ i < count ( $ a ) ; ++ $ i ) { if ( ! $ a [ $ i ] ) { continue ; } switch ( $ b [ 0 ] [ $ i ] ) { case "%d" : // the day of the month ( 00 .. 31 ) case "%e" : // the day of the month ( 0 .. 31 ) $ d = intval ( $ a [ $ i ] , 10 ) ; break ; case "%m" : // month ( 01 .. 12 ) $ m = intval ( $ a [ $ i ] , 10 ) ; break ; case "%Y" : // year including the century ( ex. 1979 ) case "%y" : // year without the century ( 00 .. 99 ) $ y = intval ( $ a [ $ i ] , 10 ) ; if ( $ y < 100 ) { $ y += ( $ y > 29 ) ? 1900 : 2000 ; } break ; case "%H" : // hour ( 00 .. 23 ) case "%I" : // hour ( 01 .. 12 ) case "%k" : // hour ( 00 .. 23 ) case "%l" : // hour ( 01 .. 12 ) $ hr = intval ( $ a [ $ i ] , 10 ) ; break ; case "%P" : // PM or AM case "%p" : // pm or am if ( $ a [ $ i ] == 'pm' && $ hr < 12 ) { $ hr += 12 ; } else if ( $ a [ $ i ] == 'am' && $ hr >= 12 ) { $ hr -= 12 ; } break ; case "%M" : // minute ( 00 .. 59 ) $ min = intval ( $ a [ $ i ] , 10 ) ; break ; case "%S" : // second ( 00 .. 59 ) $ sec = intval ( $ a [ $ i ] , 10 ) ; break ; //default: } } $ timeStamp = mktime ( $ hr , $ min , $ sec , $ m , $ d , $ y ) ; return $ timeStamp ; }
Parse formatted date to time value

@param string $fmt type - format
@param string $fmtValue - formatted string
@return int $timestamp - vallue of time
Parse formatted date to time value