PHP date_parse() Function
In this chapter you will learn:
- Definition for PHP date_parse() Function
- Syntax for PHP date_parse() Function
- Parameter for PHP date_parse() Function
- Return value from PHP date_parse() Function
- Example - Parse a string to date
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// j a v a 2s.c o m
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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP date_parse_from_format() Function
- Syntax for PHP date_parse_from_format() Function
- Parameter for PHP date_parse_from_format() Function
- Return for PHP date_parse_from_format() Function
- Example - Parse a date value
Home » PHP Tutorial » PHP Date Functions