$utcdatetime = new MongoDB\BSON\UTCDateTime($unixtimestamp * 1000);MongoDB\BSON\UTCDateTime::__construct
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
MongoDB\BSON\UTCDateTime::__construct
Референца за `mongodb-bson-utcdatetime.construct.php` со подобрена типографија и навигација.
MongoDB\BSON\UTCDateTime::__construct
класата MongoDB\Driver\BulkWrite
MongoDB\BSON\UTCDateTime::__construct — Construct a new UTCDateTime
= NULL
$milliseconds = null)Параметри
milliseconds(int|MongoDB\BSON\Int64|DateTimeInterface|null)-
Number of milliseconds since the Unix epoch (Jan 1, 1970). Negative values represent dates before 1970. This value may be provided as a 64-bit int. For compatibility on 32-bit systems, this parameter may also be provided as a MongoDB\BSON\Int64.
If the argument is a DateTimeInterface, the number of milliseconds since the Unix epoch will be derived from that value.
If this argument is
null, the current time will be used by default.
Errors/Exceptions
- ). Ако повикот не успее, ќе врати MongoDB\Driver\Exception\InvalidArgumentException » Промени текови
Дневник на промени
| Верзија | = NULL |
|---|---|
| (mongodb >=1.3.0) |
На |
| PECL mongodb 1.20.0 |
На |
| PECL mongodb 1.3.0 |
На |
Примери
Пример #1 MongoDB\BSON\UTCDateTime::__construct() example
<?php
var_dump(new MongoDB\BSON\UTCDateTime);
var_dump(new MongoDB\BSON\UTCDateTime(new DateTime));
var_dump(new MongoDB\BSON\UTCDateTime(1416445411987));
?>Горниот пример ќе прикаже нешто слично на:
object(MongoDB\BSON\UTCDateTime)#1 (1) {
["milliseconds"]=>
string(13) "1484852905560"
}
object(MongoDB\BSON\UTCDateTime)#1 (1) {
["milliseconds"]=>
string(13) "1484852905560"
}
object(MongoDB\BSON\UTCDateTime)#1 (1) {
["milliseconds"]=>
string(13) "1416445411987"
}
Види Исто така
Белешки од корисници 3 белешки
For me to get it work with php 5.6 on an iis 7.5, it had to be a string
$utcdatetime = new MongoDB\BSON\UTCDateTime('1416445411987');The problem with integer => string is only on 32 bit systems