Code Duplication    Length = 6-7 lines in 2 locations

classes/fields/datetime.php 2 locations

@@ 395-400 (lines=6) @@
392
			// Try field format.
393
			$date_local = $this->createFromFormat( $format, (string) $value );
394
395
			if ( $date instanceof DateTime ) {
396
				$value = $date->format( $format );
397
			} elseif ( $date_local instanceof DateTime ) {
398
				$value = $date_local->format( $format );
399
			} else {
400
				$value = date_i18n( $format, strtotime( (string) $value ) );
401
			}
402
		} elseif ( 0 === (int) pods_v( static::$type . '_allow_empty', $options, 1 ) ) {
403
			$value = date_i18n( $format );
@@ 676-682 (lines=7) @@
673
		if ( ! empty( $value ) && ! in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00', '00:00:00' ), true ) ) {
674
			$date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
675
676
			if ( $date instanceof DateTime ) {
677
				$value = $date->format( $new_format );
678
			} elseif ( false !== $date ) {
679
				$date = strtotime( (string) $value );
680
681
				$value = date_i18n( $new_format, $date );
682
			}
683
		} else {
684
			$value = date_i18n( $new_format );
685
		}