aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAlexander Kampmann <programmer@nurfuerspam.de>2012-04-09 14:28:21 +0200
committerAlexander Kampmann <programmer@nurfuerspam.de>2012-04-09 14:28:21 +0200
commit1370ba5d162c7a1b9931c479e2f95dfd31d13b33 (patch)
tree1710427bd23b0928d824418a80b08c676f1820ac /include
parent7187516718639fe93a9fb8fa78960bce85c7eaca (diff)
parent84142076a10b5ae52945ffc9b53e1626c5821525 (diff)
downloadvolse-hubzilla-1370ba5d162c7a1b9931c479e2f95dfd31d13b33.tar.gz
volse-hubzilla-1370ba5d162c7a1b9931c479e2f95dfd31d13b33.tar.bz2
volse-hubzilla-1370ba5d162c7a1b9931c479e2f95dfd31d13b33.zip
Merge branch 'master' of https://github.com/friendica/friendica
Diffstat (limited to 'include')
-rw-r--r--include/datetime.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/datetime.php b/include/datetime.php
index 6d395fe3f..f4dcfce62 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -80,6 +80,16 @@ function field_timezone($name='timezone', $label='', $current = 'America/Los_Ang
if(! function_exists('datetime_convert')) {
function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d H:i:s") {
+ // Defaults to UTC if nothing is set, but throws an exception if set to empty string.
+ // Provide some sane defaults regardless.
+
+ if($from === '')
+ $from = 'UTC';
+ if($to === '')
+ $to = 'UTC';
+ if($s === '')
+ $s = 'now';
+
// Slight hackish adjustment so that 'zero' datetime actually returns what is intended
// otherwise we end up with -0001-11-30 ...
// add 32 days so that we at least get year 00, and then hack around the fact that