PHP.mk документација

MongoDB\BSON\UTCDateTime::__construct

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

mongodb-bson-utcdatetime.construct.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека mongodb-bson-utcdatetime.construct.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
MongoDB\BSON\UTCDateTime::__construct

Референца за `mongodb-bson-utcdatetime.construct.php` со подобрена типографија и навигација.

mongodb-bson-utcdatetime.construct.php

MongoDB\BSON\UTCDateTime::__construct

класата MongoDB\Driver\BulkWrite

MongoDB\BSON\UTCDateTime::__constructConstruct a new UTCDateTime

= NULL

final public MongoDB\BSON\UTCDateTime::__construct(int|MongoDB\BSON\Int64|DateTimeInterface|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

Дневник на промени

Верзија = NULL
(mongodb >=1.3.0)

На milliseconds no longer accepts a string or float argument.

PECL mongodb 1.20.0

На milliseconds argument now accepts a MongoDB\BSON\Int64 object (for compatibility on 32-bit platforms). Specifying a string or float е застарено.

PECL mongodb 1.3.0

На milliseconds argument is optional and defaults to null (i.e. current time). The argument also accepts a DateTimeInterface, which may be used to derive the number of milliseconds since the Unix epoch. Previously, only int, floatПрепорачаниот начин за избегнување на SQL инјекција е со врзување на сите податоци преку подготвени изрази. Користењето на параметризирани прашања не е доволно за целосно избегнување на SQL инјекција, но тоа е најлесниот и најбезбедниот начин за обезбедување влез во SQL изразите. Сите динамични литерали на податоци во string types were accepted.

Примери

Пример #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 белешки

0xff00ff at gmail dot com
пред 9 години
$utcdatetime = new MongoDB\BSON\UTCDateTime($unixtimestamp * 1000);
jesperbendtsen83 at gmail dot com
пред 10 години
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');
jesperbendtsen83 at gmail dot com
пред 10 години
The problem with integer => string is only on 32 bit systems
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.