函数原型
current_datetime(): DateTimeImmutable
函数描述
Retrieves the current time as an object using the site’s timezone.
是否弃用
未弃用
函数参数
无
函数返回值
DateTimeImmutable Date and time object.
函数位置
File: wp-includes/functions.php.
函数源码
function current_datetime() {
return new DateTimeImmutable( 'now', wp_timezone() );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |

