current_datetime

The timeline below displays how wordpress function current_datetime has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Retrieves the current time as an object using the site's timezone.
 *
 * @since 5.3.0
 *
 * @return DateTimeImmutable Date and time object.
 */
function current_datetime()
{
    return new DateTimeImmutable('now', wp_timezone());
}

WordPress Version: 5.3

/**
 * Retrieves the current time as an object with the timezone from settings.
 *
 * @since 5.3.0
 *
 * @return DateTimeImmutable Date and time object.
 */
function current_datetime()
{
    return new DateTimeImmutable('now', wp_timezone());
}