PHP | date_parse() Function Last Updated : 06 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The date_parse() is an inbuilt function in PHP which is used to find the detailed information about a specified date. This function returns an associative array of detailed information for a specified date on success and returns FALSE on failure Syntax: date_parse($date) Parameters Used: The date_parse() function accepts only one parameter as mentioned above and described below: $date: It is a mandatory parameter which specifies the date (in a format accepted by strtotime() function) Return Value: Returns an associative array containing information about the parsed date. Errors/Exceptions: In case if the date format has an error, an error message will appear. Below programs illustrate the date_parse() function. Program 1: php <?php // PHP program to illustrate // the date_parse function print_r(date_parse("2018-06-27 12:30:45.5")); ?> Output: Array ( [year] => 2018 [month] => 6 [day] => 27 [hour] => 12 [minute] => 30 [second] => 45 [fraction] => 0.5 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => ) Program 2: If we Passing incorrect format of date in function then program run successfully but it will count errors. below program show [error_count] =gt; 1. php <?php // PHP program to illustrate // the date_parse function // Passing incorrect format of date then // it will gives errors. // [error_count] => 1 print_r(date_parse("2018-18-18")); ?> Output: Array ( [year] => 2018 [month] => 1 [day] => 1 [hour] => [minute] => [second] => [fraction] => [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [6] => Unexpected character ) [is_localtime] => 1 [zone_type] => 1 [zone] => 1080 [is_dst] => ) Reference: http://php.net/manual/en/function.date-parse.php Comment More infoAdvertise with us Next Article PHP | date_parse() Function R R_Raj Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads PHP | parse_url() Function The parse_url() function is an inbuilt function in PHP which is used to return the components of a URL by parsing it. It parses an URL and return an associative array which contains its various components. Syntax: parse_url( $url, $component = -1 ) Parameters: This function accepts two parameters as 2 min read PHP | xml_parse() Function The xml_parse() function is an inbuilt function in PHP which is used to parse XML document. Syntax:Â int xml_parse( resource $xml_parser, string $xml_data, bool $is_final ) Parameter: This function accepts three parameters as mentioned above and described below:Â Â $xml_parser: It is required paramet 3 min read PHP | date_parse_from_format() Function The date_parse_from_format() is an inbuilt function in PHP which is used to get information about given date formatted according to the specified format. The date_parse_from_format() function accepts two parameters and returns associative array with detailed information about given date. Syntax: arr 3 min read PHP | xml_parser_create_ns() Function The xml_parser_create_ns() function is an inbuilt function in PHP which is used to create an XML parser with namespace support and returns the resource handle. Syntax:Â resource xml_parser_create_ns( string $encoding, string $separator ) Parameters: This function accepts two parameters as mentioned 2 min read PHP | date_offset_get() Function The date_offset_get() function is an inbuilt function in PHP which is used to returns the timezone offset. This function returns the timezone offset in seconds from UTC (Universal Time Coordinated) on success or FALSE on failure. Syntax: Procedural Style: int date_offset_get( $object ) Object Orient 1 min read PHP | date_isodate_set() Function The date_isodate_set() function is an inbuilt function in PHP which is used to sets the ISO (International Organization for Standardization ) date. This function set the date according to the ISO 8601 standard, using weeks and day offsets rather than specific dates. Syntax: Procedural style: date_is 2 min read PHP date_sub() Function The date_sub() function is an inbuilt function in PHP that is used to subtract days, months, years, hours, minutes, and seconds from given date. This function returns a DateTime object on success and FALSE on failure. Syntax: date_sub($object, $interval)Parameters: The date_sub() function accepts tw 2 min read PHP | date_modify() Function The date_modify() function is an inbuilt function in PHP. Through the help of this function, we can modify or can alter the timestamp of DateTime object. The DateTime object and string modify are parameters in the calling function. Syntax: date_modify(DateTime $object, string $modify); Parameters: T 2 min read PHP checkdate() Function The checkdate() function in PHP is an important built-in function used to validate whether a given date is valid or not. It works by checking the values of month, day, and year, and returns true if the date is valid and false otherwise. This is particularly useful when you want to ensure a date is c 2 min read PHP | date_diff() Function The date_diff() is an inbuilt function in PHP which is used to calculate the difference between two dates. This function returns a DateInterval object on the success and returns FALSE on failure. Syntax: date_diff($datetime1, $datetime2); Parameters: The date_diff() function accepts two parameters a 2 min read Like