Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: a191144584
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (22 sloc) 0.485 kB
<?php
function test_parse_time($f)
{
if (preg_match("/[0-9]{12}/", $f)) {
$type = "YYYYMMDDHHii";
}
else if (preg_match("/[0-9]{8}\ [0-9]{4}/", $f)) {
$type = "YYYYMMDD HHii";
}
else if (preg_match("/[0-9]{4}-[0-9]{2}-[0-9]{2}/", $f)) {
$type = "YYYY-MM-DD";
}
else {
$type = "*unknown*";
}
echo "This is a $type format.\n";
}
$formats = array('2004-08-17 21:20', '20040817 2120');
foreach ($formats as $format) {
test_parse_time($format);
}
?>
Jump to Line
Something went wrong with that request. Please try again.