createFromTimestamp
static public static \Bitrix\Main\Type\DateTime::createFromTimestamp( integer $timestamp );
Static method creates object of class \DateTime
from Unix timestamp.
Parameters
Parameter | Description | Version |
---|---|---|
$timestamp | Source timestamp. |
Example
Creating object from timestamp
\Bitrix\Main\Type\DateTime::createFromTimestamp(strtotime("+5 days"));
/*$date = Bitrix\Main\Type\DateTime Object ( [value:protected] => DateTime Object ( [date] => 2014-09-02 12:00:00 [timezone_type] => 3 [timezone] => Europe/Minsk ) );*/ echo $date->toString(new \Bitrix\Main\Context\Culture(array("FORMAT_DATETIME" => "HH:MI"))); // 12:00 on output
© «Bitrix24», 2001-2024