Code Duplication    Length = 6-7 lines in 2 locations

classes/fields/datetime.php 2 locations

@@ 406-411 (lines=6) @@
403
			// Try field format.
404
			$date_local = $this->createFromFormat( $format, (string) $value );
405
406
			if ( $date instanceof DateTime ) {
407
				$value = $date->format( $format );
408
			} elseif ( $date_local instanceof DateTime ) {
409
				$value = $date_local->format( $format );
410
			} else {
411
				$value = date_i18n( $format, strtotime( (string) $value ) );
412
			}
413
		} elseif ( 0 === (int) pods_v( static::$type . '_allow_empty', $options, 1 ) ) {
414
			$value = date_i18n( $format );
@@ 696-702 (lines=7) @@
693
		if ( ! empty( $value ) && ! in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00', '00:00:00' ), true ) ) {
694
			$date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
695
696
			if ( $date instanceof DateTime ) {
697
				$value = $date->format( $new_format );
698
			} elseif ( false !== $date ) {
699
				$date = strtotime( (string) $value );
700
701
				$value = date_i18n( $new_format, $date );
702
			}
703
		} else {
704
			$value = date_i18n( $new_format );
705
		}