public static function ToDateTime( $value, $provider = null )
	{
		if ( $value instanceof \DateTime ) return $value;

		if ( is_string( $value ) )
		{
			$timestamp = strtotime( $value );

			if ( $timestamp === false ) return null;

			/**
			 * @var \DateTime $dt
			 */
			$dt = new \DateTime();
			$dt->setTimestamp( $timestamp );

			return $dt;
		}

		$value = Convert::ToInt( $value, $provider );
		if ( is_null( $value ) ) return null;

		$dt = new \DateTime();
		$dt->setTimestamp( $value );

		return $dt;
	}
public static function ToDateTime( $value, $provider = null )
	{
		if ( $value instanceof \DateTime ) return $value;

		if ( is_string( $value ) )
		{
			$timestamp = strtotime( $value );

			if ( $timestamp === false ) return null;

			/**
			 * @var \DateTime $dt
			 */
			$dt = new \DateTime();
			$dt->setTimestamp( $timestamp );

			return $dt;
		}

		$value = Convert::ToInt( $value, $provider );
		if ( is_null( $value ) ) return null;

		$dt = new \DateTime();
		$dt->setTimestamp( $value );

		return $dt;
	}
public static function ToDateTime ( $ value , $ provider = null ) { if ( $ value instanceof \ DateTime ) return $ value ; if ( is_string ( $ value ) ) { $ timestamp = strtotime ( $ value ) ; if ( $ timestamp === false ) return null ; /**
			 * @var \DateTime $dt
			 */ $ dt = new \ DateTime ( ) ; $ dt -> setTimestamp ( $ timestamp ) ; return $ dt ; } $ value = Convert :: ToInt ( $ value , $ provider ) ; if ( is_null ( $ value ) ) return null ; $ dt = new \ DateTime ( ) ; $ dt -> setTimestamp ( $ value ) ; return $ dt ; }
Converts the value of this instance to an equivalent DateTime using the
specified culture-specific formatting information.

@param object $value The value to convert
@param IFormatProvider $provider An interface implementation that supplies culture-specific formatting information.
@return DateTime A DateTime instance equivalent to the value of this instance.
Converts the value of this instance to an equivalent DateTime using the specified culture - specific formatting information .