1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 17:37:25 +02:00

Problèmes de date

This commit is contained in:
Yohann
2020-01-01 22:41:08 +01:00
parent d81ad02235
commit 64ffcedbcc
5 changed files with 8 additions and 9 deletions

View File

@ -9,14 +9,14 @@ function ensure($bool, $error_msg = "")
function formatDate($date = NULL, $with_time = false)
{
if ($date == NULL)
$date = date("yyyy-mm-dd");
$date = date("Y-m-d H:i:s");
return strftime("%d %B %G" . ($with_time ? " %H:%M" : ""), strtotime($date));
}
function dateWellFormed($date, $with_time = false)
{
return date_parse_from_format($with_time ? "yyyy-mm-dd HH-MM:ss" : "yy-mm-dd", $date) !== false;
return date_parse_from_format($with_time ? "Y-m-d H:i:s" : "Y-m-d", $date) !== false;
}
function genRandomPhrase($size, $uppercase = false)