Example #1
0
 /**
  * @param \MongoDB\BSON\UTCDatetime $mongoDate
  * @return UniversalTimestamp
  */
 public static function fromMongodbUTCDateTime(\MongoDB\BSON\UTCDatetime $mongoDate)
 {
     return UniversalTimestamp::fromMillisecondsTimestamp((int) $mongoDate->__toString());
 }
Example #2
0
 /**
  * @param \MongoDate $mongoDate
  * @return UniversalTimestamp
  */
 public static function fromMongoDate(\MongoDate $mongoDate)
 {
     return UniversalTimestamp::fromMillisecondsTimestamp($mongoDate->sec * 1000 + (int) ($mongoDate->usec / 1000));
 }