回答編集履歴
1
調整
test
CHANGED
@@ -8,11 +8,15 @@
|
|
8
8
|
|
9
9
|
function checkDatetimeFormat($datetime){
|
10
10
|
|
11
|
-
$pattern='/^(?P<year>\d+)\-(?P<month>\d+)-(?P<day>\d+) (
|
11
|
+
$pattern='/^(?P<year>\d+)\-(?P<month>\d+)-(?P<day>\d+) (?P<hour>\d+):(?P<minute>\d+):(?P<second>\d+)$/';
|
12
|
+
|
13
|
+
preg_match($pattern, $datetime, $m);
|
12
14
|
|
13
15
|
return preg_match($pattern, $datetime, $m) and
|
14
16
|
|
15
|
-
checkdate($m['month'] , $m['day'] , $m['year'])
|
17
|
+
checkdate($m['month'] , $m['day'] , $m['year']) and
|
18
|
+
|
19
|
+
$m['hour']<24 and $m['minute']<60 and $m['second']<60 ;
|
16
20
|
|
17
21
|
}
|
18
22
|
|