选择语言 :

 Core_Date::dos2unix

Converts a DOS timestamp to UNIX format.There are very few cases where this is needed, but some binary formats use it (eg: zip files.) Converting the other direction is done using {@link Date::unix2dos}.

$unix = Date::dos2unix($dos);

integer Core_Date::dos2unix( [ integer $timestamp = bool false ] )

参数列表

参数 类型 描述 默认值
$timestamp integer DOS timestamp bool false
返回值
  • integer
File: ./core/classes/date.class.php
public static function dos2unix($timestamp = FALSE)
{
    $sec = 2 * ($timestamp & 0x1f);
    $min = ($timestamp >> 5) & 0x3f;
    $hrs = ($timestamp >> 11) & 0x1f;
    $day = ($timestamp >> 16) & 0x1f;
    $mon = ($timestamp >> 21) & 0x0f;
    $year = ($timestamp >> 25) & 0x7f;

    return mktime($hrs, $min, $sec, $mon, $day, $year + 1980);
}