mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-29 04:22:24 +00:00
17 lines
446 B
PHP
17 lines
446 B
PHP
<?php
|
|
|
|
function ensure($bool, $error_msg = "") {
|
|
if (!$bool)
|
|
throw new AssertionError($error_msg);
|
|
}
|
|
|
|
function formatDate($date = NULL, $with_time = false) {
|
|
if ($date == NULL)
|
|
$date = date("yyyy-mm-dd");
|
|
|
|
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;
|
|
} |