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 );
@@ 689-695 (lines=7) @@
686
		if ( ! empty( $value ) && ! in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00', '00:00:00' ), true ) ) {
687
			$date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
688
689
			if ( $date instanceof DateTime ) {
690
				$value = $date->format( $new_format );
691
			} elseif ( false !== $date ) {
692
				$date = strtotime( (string) $value );
693
694
				$value = date_i18n( $new_format, $date );
695
			}
696
		} else {
697
			$value = date_i18n( $new_format );
698
		}