diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index 8e929f38a7..6626937568 100644
--- a/src/wp-admin/includes/media.php
+++ b/src/wp-admin/includes/media.php
@@ -430,21 +430,23 @@ function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid
  * @since 2.6.0
  * @since 5.3.0 The `$post_id` parameter was made optional.
  *
- * @param array  $file_array Array that represents a `$_FILES` upload array.
- * @param int    $post_id    Optional. The post ID the media is associated with.
- * @param string $desc       Optional. Description of the side-loaded file. Default null.
- * @param array  $post_data  Optional. Post data to override. Default empty array.
+ * @param string[]  $file_array Array that represents a `$_FILES` upload array.
+ * @param int       $post_id    Optional. The post ID the media is associated with.
+ * @param string    $desc       Optional. Description of the side-loaded file. Default null.
+ * @param array     $post_data  Optional. Post data to override. Default empty array.
  * @return int|WP_Error The ID of the attachment or a WP_Error on failure.
  */
 function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) {
 	$overrides = array( 'test_form' => false );
 
-	$time = current_time( 'mysql' );
-	$post = get_post( $post_id );
-
-	if ( $post ) {
-		if ( substr( $post->post_date, 0, 4 ) > 0 ) {
+	if ( isset( $post_data['post_date'] ) && substr( $post_data['post_date'], 0, 4 ) > 0 ) {
+		$time = $post_data['post_date'];
+	} else {
+		$post = get_post( $post_id );
+		if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) {
 			$time = $post->post_date;
+		} else {
+			$time = current_time( 'mysql' );
 		}
 	}
 
