function gps2unix($gpsTime)
{
    // Add offset in seconds
    $unixTime = $gpsTime + 315964800;
    $nleaps = countleaps($gpsTime, 'gps2unix');
    $unixTime = $unixTime - $nleaps;
    if (isleap($gpsTime)) {
        $unixTime = $unixTime + 0.5;
    }
    return $unixTime;
}
/**
 * 指定した月の日数を返す
 * @param	int $year  西暦年
 * @param	int $month 月
 * @return	int 日数/FALSE:引数の異常
*/
function getDaysInMonth($year, $month)
{
    static $days = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    if ($month < 1 || $month > 12) {
        return FALSE;
    }
    $days[2] = isleap($year) ? 29 : 28;
    //閏年の判定
    return $days[$month];
}
Exemple #3
0
function ydp_to_ymd($y, $d)
{
    $md = array(array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365), array(0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366));
    $d -= 1;
    $m = trunc($d / 29);
    if ($md[isleap($y) - 0][$m] > $d) {
        $m -= 1;
    }
    $d = $d - $md[isleap($y) - 0][$m] + 1;
    $m += 1;
    return strcat($y, '-', str_pad_left($m, 2, '0'), '-', str_pad_left($d, 2, '0'));
}