Code Duplication    Length = 6-7 lines in 2 locations

classes/fields/datetime.php 2 locations

@@ 456-461 (lines=6) @@
453
			// Try field format.
454
			$date_local = $this->createFromFormat( $format, (string) $value );
455
456
			if ( $date instanceof DateTime ) {
457
				$value = $date->format( $format );
458
			} elseif ( $date_local instanceof DateTime ) {
459
				$value = $date_local->format( $format );
460
			} else {
461
				$value = date_i18n( $format, strtotime( (string) $value ) );
462
			}
463
		} elseif ( 0 == pods_v( static::$type . '_allow_empty', $options, 1 ) ) {
464
			$value = date_i18n( $format );
@@ 743-749 (lines=7) @@
740
		if ( ! empty( $value ) && ! in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00', '00:00:00' ) ) ) {
741
			$date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
742
743
			if ( $date instanceof DateTime ) {
744
				$value = $date->format( $new_format );
745
			} elseif ( false !== $date ) {
746
				$date = strtotime( (string) $value );
747
748
				$value = date_i18n( $new_format, $date );
749
			}
750
		} else {
751
			$value = date_i18n( $new_format );
752
		}