diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
index d45f1e2477..8e2469fb80 100644
--- a/src/wp-admin/includes/dashboard.php
+++ b/src/wp-admin/includes/dashboard.php
@@ -860,7 +860,7 @@ function wp_dashboard_recent_posts( $args ) {
echo '
';
$today = current_time( 'Y-m-d' );
- $tomorrow = gmdate( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) );
+ $tomorrow = current_datetime()->modify( '+1 day' )->format( 'Y-m-d' );
$year = current_time( 'Y' );
while ( $posts->have_posts() ) {
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 3415f3f854..9c8fc5d998 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -79,6 +79,17 @@ function current_time( $type, $gmt = 0 ) {
return $datetime->format( $type );
}
+/**
+ * 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() );
+}
+
/**
* Retrieves the timezone from current settings as a string.
*