current_datetime() WordPress Function
The current_datetime() function is used to retrieve the current date and time. This function is useful for display purposes, such as in a date or time picker.
current_datetime() #
Retrieves the current time as an object using the site’s timezone.
Return
(DateTimeImmutable) Date and time object.
Source
File: wp-includes/functions.php
function current_datetime() { return new DateTimeImmutable( 'now', wp_timezone() ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.3.0 | Introduced. |