current_datetime()WP 5.3.0

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

No Hooks.

Return

DateTimeImmutable. Date and time object.

Usage

current_datetime();

Changelog

Since 5.3.0 Introduced.

current_datetime() code WP 6.5.2

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