Skip to content

Commit 7808082

Browse files
committed
Merge composer/master
2 parents ca2c5c6 + f215070 commit 7808082

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Utility/NetCommonsTime.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,20 @@ public function getUserTimezone() {
174174
}
175175
return $userTimezone;
176176
}
177+
178+
/**
179+
* DateTime型チェック
180+
*
181+
* @param string $value datetimeの値
182+
* @return bool DateTime型
183+
*/
184+
public function isDatetime($value) {
185+
try {
186+
// DateTime値チェック($value=20150716150000 or 2018-06-26 11:37:39いずれにも対応)
187+
new DateTime($value, new DateTimeZone('UTC'));
188+
} catch (Exception $e) {
189+
return false;
190+
}
191+
return true;
192+
}
177193
}

0 commit comments

Comments
 (0)