src/DateTime.php
public static function __parse($date, &$result = null)							//	WARNING I don't think I  need this ...
	{
		$result = date_parse($date);

		if ($result['warning_count'] === 0 && $result['error_count'] === 0)			//	halt, I think there is a faster way to build the DateTime ... just parse it here, check for errors ... then just build it ....
		{
			$year		=	$result['year'];
			$month		=	$result['month'];
			$day		=	$result['day'];
			$hour		=	$result['hour'];
			$minute		=	$result['minute'];
			$second		=	$result['second'];
			$fraction	=	$result['fraction'];

			$format		=	null;
			$value		=	null;

			if (is_numeric($year) && is_numeric($month) && is_numeric($day))
			{
				$value	= str_pad($year, 4, '0', STR_PAD_LEFT) . str_pad($month, 3, '-0', STR_PAD_LEFT) . str_pad($day, 3, '-0', STR_PAD_LEFT);
				$format = 'Y-m-d';
			}

			if (is_numeric($hour) && is_numeric($minute) && is_numeric($second))
			{
				$value	.= str_pad($hour, 2, '0', STR_PAD_LEFT) . str_pad($minute, 3, ':0', STR_PAD_LEFT) . str_pad($second, 3, ':0', STR_PAD_LEFT);
				$format	.= 'H:i:s';
			}

			$is_localtime	=	$result['is_localtime'];

			if ($is_localtime)
			{
				
			}
		}

		return null;
	}
public static function __parse($date, &$result = null)							//	WARNING I don't think I  need this ...
	{
		$result = date_parse($date);

		if ($result['warning_count'] === 0 && $result['error_count'] === 0)			//	halt, I think there is a faster way to build the DateTime ... just parse it here, check for errors ... then just build it ....
		{
			$year		=	$result['year'];
			$month		=	$result['month'];
			$day		=	$result['day'];
			$hour		=	$result['hour'];
			$minute		=	$result['minute'];
			$second		=	$result['second'];
			$fraction	=	$result['fraction'];

			$format		=	null;
			$value		=	null;

			if (is_numeric($year) && is_numeric($month) && is_numeric($day))
			{
				$value	= str_pad($year, 4, '0', STR_PAD_LEFT) . str_pad($month, 3, '-0', STR_PAD_LEFT) . str_pad($day, 3, '-0', STR_PAD_LEFT);
				$format = 'Y-m-d';
			}

			if (is_numeric($hour) && is_numeric($minute) && is_numeric($second))
			{
				$value	.= str_pad($hour, 2, '0', STR_PAD_LEFT) . str_pad($minute, 3, ':0', STR_PAD_LEFT) . str_pad($second, 3, ':0', STR_PAD_LEFT);
				$format	.= 'H:i:s';
			}

			$is_localtime	=	$result['is_localtime'];

			if ($is_localtime)
			{
				
			}
		}

		return null;
	}
public static function __parse ( $ date , & $ result = null ) //	WARNING I don't think I  need this ...
 { $ result = date_parse ( $ date ) ; if ( $ result [ 'warning_count' ] === 0 && $ result [ 'error_count' ] === 0 ) //	halt, I think there is a faster way to build the DateTime ... just parse it here, check for errors ... then just build it ....
 { $ year = $ result [ 'year' ] ; $ month = $ result [ 'month' ] ; $ day = $ result [ 'day' ] ; $ hour = $ result [ 'hour' ] ; $ minute = $ result [ 'minute' ] ; $ second = $ result [ 'second' ] ; $ fraction = $ result [ 'fraction' ] ; $ format = null ; $ value = null ; if ( is_numeric ( $ year ) && is_numeric ( $ month ) && is_numeric ( $ day ) ) { $ value = str_pad ( $ year , 4 , '0' , STR_PAD_LEFT ) . str_pad ( $ month , 3 , '-0' , STR_PAD_LEFT ) . str_pad ( $ day , 3 , '-0' , STR_PAD_LEFT ) ; $ format = 'Y-m-d' ; } if ( is_numeric ( $ hour ) && is_numeric ( $ minute ) && is_numeric ( $ second ) ) { $ value .= str_pad ( $ hour , 2 , '0' , STR_PAD_LEFT ) . str_pad ( $ minute , 3 , ':0' , STR_PAD_LEFT ) . str_pad ( $ second , 3 , ':0' , STR_PAD_LEFT ) ; $ format .= 'H:i:s' ; } $ is_localtime = $ result [ 'is_localtime' ] ; if ( $ is_localtime ) { } } return null ; }
Wrapper around date_parse

@link	http://php.net/manual/en/function.date-parse.php


@param  mixed  $str      Value to modify, after being cast to string
@param  string $encoding The character encoding

@throws \InvalidArgumentException if an array or object without a
__toString method is passed as the first argument

@return static|null
Wrapper around date_parse