public function getDateTime()
    {
        if ($this->getVersion() != 1) {
            throw new Exception\UnsupportedOperationException('Not a time-based UUID');
        }


        if (self::is64BitSystem()) {

            $unixTime = ($this->getTimestamp() - 0x01b21dd213814000) / 1e7;
            $unixTime = number_format($unixTime, 0, '', '');

        } elseif (self::hasBigNumber()) {

            $time = \Moontoast\Math\BigNumber::baseConvert($this->getTimestampHex(), 16, 10);

            $ts = new \Moontoast\Math\BigNumber($time, 20);
            $ts->subtract('122192928000000000');
            $ts->divide('10000000.0');
            $ts->round();
            $unixTime = $ts->getValue();

        } else {

            throw new Exception\UnsatisfiedDependencyException(
                'When calling ' . __METHOD__ . ' on a 32-bit system, '
                . 'Moontoast\Math\BigNumber must be present in order '
                . 'to extract DateTime from version 1 UUIDs'
            );

        }

        return new \DateTime("@{$unixTime}");
    }
public function getDateTime()
    {
        if ($this->getVersion() != 1) {
            throw new Exception\UnsupportedOperationException('Not a time-based UUID');
        }


        if (self::is64BitSystem()) {

            $unixTime = ($this->getTimestamp() - 0x01b21dd213814000) / 1e7;
            $unixTime = number_format($unixTime, 0, '', '');

        } elseif (self::hasBigNumber()) {

            $time = \Moontoast\Math\BigNumber::baseConvert($this->getTimestampHex(), 16, 10);

            $ts = new \Moontoast\Math\BigNumber($time, 20);
            $ts->subtract('122192928000000000');
            $ts->divide('10000000.0');
            $ts->round();
            $unixTime = $ts->getValue();

        } else {

            throw new Exception\UnsatisfiedDependencyException(
                'When calling ' . __METHOD__ . ' on a 32-bit system, '
                . 'Moontoast\Math\BigNumber must be present in order '
                . 'to extract DateTime from version 1 UUIDs'
            );

        }

        return new \DateTime("@{$unixTime}");
    }
public function getDateTime ( ) { if ( $ this -> getVersion ( ) != 1 ) { throw new Exception \ UnsupportedOperationException ( 'Not a time-based UUID' ) ; } if ( self :: is64BitSystem ( ) ) { $ unixTime = ( $ this -> getTimestamp ( ) - 0x01b21dd213814000 ) / 1e7 ; $ unixTime = number_format ( $ unixTime , 0 , '' , '' ) ; } elseif ( self :: hasBigNumber ( ) ) { $ time = \ Moontoast \ Math \ BigNumber :: baseConvert ( $ this -> getTimestampHex ( ) , 16 , 10 ) ; $ ts = new \ Moontoast \ Math \ BigNumber ( $ time , 20 ) ; $ ts -> subtract ( '122192928000000000' ) ; $ ts -> divide ( '10000000.0' ) ; $ ts -> round ( ) ; $ unixTime = $ ts -> getValue ( ) ; } else { throw new Exception \ UnsatisfiedDependencyException ( 'When calling ' . __METHOD__ . ' on a 32-bit system, ' . 'Moontoast\Math\BigNumber must be present in order ' . 'to extract DateTime from version 1 UUIDs' ) ; } return new \ DateTime ( "@{$unixTime}" ) ; }
Returns a PHP DateTime object representing the timestamp associated
with this UUID.

The timestamp value is only meaningful in a time-based UUID, which
has version type 1. If this UUID is not a time-based UUID then
this method throws UnsupportedOperationException.

@return \DateTime A PHP DateTime representation of the date
@throws Exception\UnsupportedOperationException If this UUID is not a version 1 UUID
@throws Exception\UnsatisfiedDependencyException if called on a 32-bit system and Moontoast\Math\BigNumber is not present
Returns a PHP DateTime object representing the timestamp associated with this UUID .