diff options
author | Michael Vogel <icarus@dabo.de> | 2012-04-11 19:35:51 +0200 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-04-11 19:35:51 +0200 |
commit | ee714daf4d33f8258e1301438423fc10a3bdc916 (patch) | |
tree | e3da18226db88c42819e2f29b67763581eb1c293 /include/datetime.php | |
parent | c88c2515e43f7a446a9b358fb657290a8a6c847a (diff) | |
parent | a1d5026abf129fc520327881a293d17c1ab21eff (diff) | |
download | volse-hubzilla-ee714daf4d33f8258e1301438423fc10a3bdc916.tar.gz volse-hubzilla-ee714daf4d33f8258e1301438423fc10a3bdc916.tar.bz2 volse-hubzilla-ee714daf4d33f8258e1301438423fc10a3bdc916.zip |
Merge commit 'upstream/master'
Diffstat (limited to 'include/datetime.php')
-rw-r--r-- | include/datetime.php | 10 |
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 |