src/util/Date.php
public static function unix2dos($timestamp = null) {
        $timestamp = getdate($timestamp);

        if ($timestamp['year'] < 1980) {
            return (1 << 21 | 1 << 16);
        }

        $timestamp['year'] -= 1980;

        // What voodoo is this? I have no idea... Geert can explain it though,
        // and that's good enough for me.
        return ($timestamp['year'] << 25 | $timestamp['mon'] << 21 |
            $timestamp['mday'] << 16 | $timestamp['hours'] << 11 |
            $timestamp['minutes'] << 5 | $timestamp['seconds'] >> 1);
    }
public static function unix2dos($timestamp = null) {
        $timestamp = getdate($timestamp);

        if ($timestamp['year'] < 1980) {
            return (1 << 21 | 1 << 16);
        }

        $timestamp['year'] -= 1980;

        // What voodoo is this? I have no idea... Geert can explain it though,
        // and that's good enough for me.
        return ($timestamp['year'] << 25 | $timestamp['mon'] << 21 |
            $timestamp['mday'] << 16 | $timestamp['hours'] << 11 |
            $timestamp['minutes'] << 5 | $timestamp['seconds'] >> 1);
    }
public static function unix2dos ( $ timestamp = null ) { $ timestamp = getdate ( $ timestamp ) ; if ( $ timestamp [ 'year' ] < 1980 ) { return ( 1 << 21 | 1 << 16 ) ; } $ timestamp [ 'year' ] -= 1980 ; // What voodoo is this? I have no idea... Geert can explain it though, // and that's good enough for me. return ( $ timestamp [ 'year' ] << 25 | $ timestamp [ 'mon' ] << 21 | $ timestamp [ 'mday' ] << 16 | $ timestamp [ 'hours' ] << 11 | $ timestamp [ 'minutes' ] << 5 | $ timestamp [ 'seconds' ] >> 1 ) ; }
Converts a UNIX timestamp to DOS 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::dos2unix}.

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

@param   integer $timestamp UNIX timestamp
@return  integer
Converts a UNIX timestamp to DOS 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 :: dos2unix } .