PHP Tutorial - PHP date_parse() Function






Definition

The date_parse() function parses string to get a date.

Syntax

PHP date_parse() Function has the following syntax.

date_parse(date);

Parameter

date - Required. Date in a format accepted by strtotime()

Return

PHP date_parse() Function returns parsed date on success. FALSE on failure.

Example

Parse a string to date


<?php
print_r(date_parse("2013-05-01 12:30:45.5"));
echo "\n";
$time = "00:14:38";
$parse_date = date_parse($time);
echo var_dump($parse_date) ."\n";

?>

The code above generates the following result.