classes/fields/datetime.php
public function createFromFormat( $format, $date, $return_timestamp = false ) {

		$datetime = null;

		try {
			if ( method_exists( 'DateTime', 'createFromFormat' ) ) {
				$timezone = get_option( 'timezone_string' );

				if ( empty( $timezone ) ) {
					$timezone = timezone_name_from_abbr( '', get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, 0 );
				}

				if ( ! empty( $timezone ) ) {
					$datetimezone = new DateTimeZone( $timezone );

					$datetime = DateTime::createFromFormat( $format, (string) $date, $datetimezone );

					if ( false === $datetime ) {
						$datetime = DateTime::createFromFormat( static::$storage_format, (string) $date, $datetimezone );
					}

					if ( false !== $datetime && $return_timestamp ) {
						return $datetime;
					}
				}
			}//end if

			if ( in_array( $datetime, array( null, false ), true ) ) {
				if ( empty( $date ) ) {
					$timestamp = time();
				} else {
					$timestamp = strtotime( (string) $date );

					if ( $return_timestamp ) {
						return $timestamp;
					}
				}

				if ( $timestamp ) {
					$datetime = new DateTime( date_i18n( static::$storage_format, $timestamp ) );
				}
			}
		} catch ( Exception $e ) {
			// There is no saving this time value, it's an exception to the rule.
		}

		return apply_filters( 'pods_form_ui_field_datetime_formatter', $datetime, $format, $date );
	}
public function createFromFormat( $format, $date, $return_timestamp = false ) {

		$datetime = null;

		try {
			if ( method_exists( 'DateTime', 'createFromFormat' ) ) {
				$timezone = get_option( 'timezone_string' );

				if ( empty( $timezone ) ) {
					$timezone = timezone_name_from_abbr( '', get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, 0 );
				}

				if ( ! empty( $timezone ) ) {
					$datetimezone = new DateTimeZone( $timezone );

					$datetime = DateTime::createFromFormat( $format, (string) $date, $datetimezone );

					if ( false === $datetime ) {
						$datetime = DateTime::createFromFormat( static::$storage_format, (string) $date, $datetimezone );
					}

					if ( false !== $datetime && $return_timestamp ) {
						return $datetime;
					}
				}
			}//end if

			if ( in_array( $datetime, array( null, false ), true ) ) {
				if ( empty( $date ) ) {
					$timestamp = time();
				} else {
					$timestamp = strtotime( (string) $date );

					if ( $return_timestamp ) {
						return $timestamp;
					}
				}

				if ( $timestamp ) {
					$datetime = new DateTime( date_i18n( static::$storage_format, $timestamp ) );
				}
			}
		} catch ( Exception $e ) {
			// There is no saving this time value, it's an exception to the rule.
		}

		return apply_filters( 'pods_form_ui_field_datetime_formatter', $datetime, $format, $date );
	}
public function createFromFormat ( $ format , $ date , $ return_timestamp = false ) { $ datetime = null ; try { if ( method_exists ( 'DateTime' , 'createFromFormat' ) ) { $ timezone = get_option ( 'timezone_string' ) ; if ( empty ( $ timezone ) ) { $ timezone = timezone_name_from_abbr ( '' , get_option ( 'gmt_offset' ) * HOUR_IN_SECONDS , 0 ) ; } if ( ! empty ( $ timezone ) ) { $ datetimezone = new DateTimeZone ( $ timezone ) ; $ datetime = DateTime :: createFromFormat ( $ format , ( string ) $ date , $ datetimezone ) ; if ( false === $ datetime ) { $ datetime = DateTime :: createFromFormat ( static :: $ storage_format , ( string ) $ date , $ datetimezone ) ; } if ( false !== $ datetime && $ return_timestamp ) { return $ datetime ; } } } //end if if ( in_array ( $ datetime , array ( null , false ) , true ) ) { if ( empty ( $ date ) ) { $ timestamp = time ( ) ; } else { $ timestamp = strtotime ( ( string ) $ date ) ; if ( $ return_timestamp ) { return $ timestamp ; } } if ( $ timestamp ) { $ datetime = new DateTime ( date_i18n ( static :: $ storage_format , $ timestamp ) ) ; } } } catch ( Exception $ e ) { // There is no saving this time value, it's an exception to the rule. } return apply_filters ( 'pods_form_ui_field_datetime_formatter' , $ datetime , $ format , $ date ) ; }
PHP backwards compatibility for createFromFormat.

@param string  $format           Format string.
@param string  $date             Defaults to time() if empty.
@param boolean $return_timestamp Whether to return the strtotime() or createFromFormat result or not.

@return DateTime|null|int|false
PHP backwards compatibility for createFromFormat .