Index: src/wp-includes/functions.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/functions.php	(date 1571173968000)
+++ src/wp-includes/functions.php	(date 1571990849469)
@@ -176,9 +176,9 @@
 	 */
 	if ( 'U' === $format ) {
 		$date = $timestamp;
-	} elseif ( $gmt && ! $timestamp_with_offset ) { // Current time in UTC.
+	} elseif ( $gmt && ( false === $timestamp_with_offset ) ) { // Current time in UTC.
 		$date = wp_date( $format, null, new DateTimeZone( 'UTC' ) );
-	} elseif ( ! $timestamp_with_offset ) { // Current time in site's timezone.
+	} elseif ( false === $timestamp_with_offset ) { // Current time in site's timezone.
 		$date = wp_date( $format );
 	} else {
 		/*
Index: tests/phpunit/tests/date/dateI18n.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/phpunit/tests/date/dateI18n.php	(date 1571173968000)
+++ tests/phpunit/tests/date/dateI18n.php	(date 1571990816441)
@@ -19,6 +19,21 @@
 		$this->assertEquals( $wp_timestamp, date_i18n( 'U', 'invalid' ), '', 5 );
 	}
 
+	public function test_should_handle_zero_timestamp() {
+		$timezone = 'Europe/Kiev';
+		update_option( 'timezone_string', $timezone );
+
+		$datetime = DateTimeImmutable::createFromFormat(
+			'Y-m-d H:i:s',
+			'1970-01-01 00:00:00',
+			new DateTimeZone( $timezone )
+		);
+		$rfc3339  = $datetime->format( DATE_RFC3339 );
+
+		$this->assertEquals( 0, date_i18n( 'U', 0 ) );
+		$this->assertEquals( $rfc3339, date_i18n( DATE_RFC3339, 0 ) );
+	}
+
 	public function test_should_format_date() {
 		$this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 );
 	}
