Example #1
0
function parse_dvdfr_release_date($day, $monthname, $year)
{
    $dvdfr_month_map = array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "aout", "septembre", "octobre", "novembre", "décembre");
    $month = get_month_num_for_name($monthname, $dvdfr_month_map);
    if ($month < 10) {
        $month = '0' . $month;
    }
    $timestamp = @mktime(0, 0, 0, $month, $day, $year);
    return date('d/m/Y', $timestamp);
}
Example #2
0
/**
 * MMM DD, YYYY
 * MMM, YYYY
 * YYYY
 *
 * @param unknown_type $date
 * @return unknown
 */
function parse_mobygames_release_date($date)
{
    $months = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
    if (preg_match("/([a-zA-Z]+) ([0-9]*), ([0-9]*)/", $date, $matches) || preg_match("/([a-zA-Z]+), ([0-9]*)/", $date, $matches) || preg_match("/([0-9]*)/", $date, $matches)) {
        $day = 1;
        $month = 1;
        if (count($matches) > 3) {
            $month = get_month_num_for_name($matches[1], $months);
            $day = $matches[2];
            $year = $matches[3];
        } else {
            if (count($matches) > 2) {
                $month = get_month_num_for_name($matches[1], $months);
                $year = $matches[2];
            } else {
                $year = $matches[1];
            }
        }
        $timestamp = @mktime(0, 0, 0, $month, $day, $year);
        return date('d/m/Y', $timestamp);
    }
    //else
    return FALSE;
}