Retrieves the current time as an object using the site’s timezone.
function current_datetime() {
return new DateTimeImmutable( 'now', wp_timezone() );
}
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/current_datetime