aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/Utils.php')
-rw-r--r--application/Utils.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/application/Utils.php b/application/Utils.php
index 82220bfc..a1e97b35 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -69,4 +69,19 @@ function sanitizeLink(&$link)
69 $link['description'] = escape($link['description']); 69 $link['description'] = escape($link['description']);
70 $link['tags'] = escape($link['tags']); 70 $link['tags'] = escape($link['tags']);
71} 71}
72
73/**
74 * Checks if a string represents a valid date
75 *
76 * @param string a string-formatted date
77 * @param format the expected DateTime format of the string
78 * @return whether the string is a valid date
79 * @see http://php.net/manual/en/class.datetime.php
80 * @see http://php.net/manual/en/datetime.createfromformat.php
81 */
82function checkDateFormat($format, $string)
83{
84 $date = DateTime::createFromFormat($format, $string);
85 return $date && $date->format($string) == $string;
86}
72?> 87?>