wordpress / latest / functions / current_datetime.html

current_datetime(): DateTimeImmutable

Retrieves the current time as an object using the site’s timezone.

Return

DateTimeImmutable Date and time object.

Source

File: wp-includes/functions.php. View all references

function current_datetime() {
	return new DateTimeImmutable( 'now', wp_timezone() );
}

Uses

Uses Description

Used By

Used By Description

Changelog

Version Description
5.3.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/current_datetime