current_datetime()
Retrieves the current time as an object using the site's timezone.
No Hooks.
Returns
DateTimeImmutable. Date and time object.
Usage
current_datetime();
Changelog
| Since 5.3.0 | Introduced. |
current_datetime() current datetime code WP 7.0
function current_datetime() {
return new DateTimeImmutable( 'now', wp_timezone() );
}