略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: date_timestamp_set

2024-11-15

date_timestamp_set

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

date_timestamp_set别名 DateTime::setTimestamp()

说明

此函数是该函数的别名: DateTime::setTimestamp()

add a noteadd a note

User Contributed Notes 1 note

up
-27
prt dot ed48 dot com
8 years ago
Example 01:

<?php

date_default_timezone_set
("UTC");

$dftz011 = date_default_timezone_get();

echo
'<br><b>' . $dftz011 . '</b><br><br>';

$dtms011 = new DateTime();

$dtms011->setTimestamp(1234567890);

echo
$dtms011->format('B => (U) => T Y-M-d H:i:s');

?>

Example 02:

<?php

date_default_timezone_set
("America/New_York");

$dftz021 = date_default_timezone_get();

echo
'<br><b>' . $dftz021 . '</b><br><br>';

$dtms021 = date_create();

date_timestamp_set($dtms021, 1234567890);

echo
date_format($dtms021, 'B => (U) => T Y-M-d H:i:s');

?>

官方地址:https://www.php.net/manual/en/function.date-timestamp-set.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3