18 digit timestamp?

后端 未结 3 1395
不思量自难忘°
不思量自难忘° 2020-12-19 11:10

I am working on a system related to tv recordings.

I am parsing the following xml from another system (to which i have no documentation):



        
相关标签:
3条回答
  • 2020-12-19 11:32

    It looks like C#'s DateTime ticks:

    The DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.)

    This line:

    Console.WriteLine (new DateTime (633936042047633656));
    

    prints:

    11/12/2009 6:30:04 AM

    If you need to convert from those numbers to Unix time, substract 621355968000000000L, which is the Unix epoch expressed in ticks.

    0 讨论(0)
  • 2020-12-19 11:46

    With the gmp lib installed in php you can do it like this:

    $epoch     = '621355968000000000';
    $newtime   = gmp_sub($dateTime, $epoch);
    $newtime   = gmp_div($newtime, '10000000');
    $timestamp = gmp_strval($newtime);
    

    and now you got a date:

    echo date('Y-m-d H:i:s', $timestamp);
    
    0 讨论(0)
  • 2020-12-19 11:47
    $dateLargeInt= "131424999530821857";
    $secsAfterADEpoch = $dateLargeInt / (10000000); 
    $ADToUnixConvertor=((1970-1601) * 365.242190) * 86400;
    // unix epoch - AD epoch * number of tropical days * seconds in a day 
    $unixTsLastLogon=intval($secsAfterADEpoch-$ADToUnixConvertor); 
    
    // unix Timestamp version of AD timestamp
    $lastlogon=date("d-m-Y", $unixTsLastLogon); // formatted date
    
    echo $lastlogon;
    
    0 讨论(0)
提交回复
热议问题