Code Duplication    Length = 6-7 lines in 2 locations

classes/fields/datetime.php 2 locations

@@ 432-437 (lines=6) @@
429
			// Try field format.
430
			$date_local = $this->createFromFormat( $format, (string) $value );
431
432
			if ( $date instanceof DateTime )
433
				$value = $date->format( $format );
434
			elseif ( $date_local instanceof DateTime )
435
				$value = $date_local->format( $format );
436
			else
437
				$value = date_i18n( $format, strtotime( (string) $value ) );
438
		}
439
		elseif ( 0 == pods_v( static::$type . '_allow_empty', $options, 1 ) )
440
			$value = date_i18n( $format );
@@ 704-710 (lines=7) @@
701
		if ( ! empty( $value ) && ! in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00', '00:00:00' ) ) ) {
702
			$date = $this->createFromFormat( $original_format, (string) $value, $return_timestamp );
703
704
			if ( $date instanceof DateTime ) {
705
				$value = $date->format( $new_format );
706
			} elseif ( false !== $date ) {
707
				$date = strtotime( (string) $value );
708
709
				$value = date_i18n( $new_format, $date );
710
			}
711
		} else {
712
			$value = date_i18n( $new_format );
713
		}