From ea00eb2ea27613491eb517be9659059696fb335b Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Sun, 6 Jan 2013 19:16:09 +0000 Subject: backpotder r3238, r3239 to trunk/ --- framework/Util/TDateTimeStamp.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'framework/Util/TDateTimeStamp.php') diff --git a/framework/Util/TDateTimeStamp.php b/framework/Util/TDateTimeStamp.php index a7a43b3c..f5f76004 100644 --- a/framework/Util/TDateTimeStamp.php +++ b/framework/Util/TDateTimeStamp.php @@ -102,6 +102,30 @@ class TDateTimeStamp return (int) $dt->format('Z'); } + /** + * @return array an array with date info. + */ + function parseDate($txt=false) + { + if ($txt === false) return getdate(); + + $dt = new DateTime($txt); + + return array( + 'seconds' => (int) $dt->format('s'), + 'minutes' => (int) $dt->format('i'), + 'hours' => (int) $dt->format('G'), + 'mday' => (int) $dt->format('j'), + 'wday' => (int) $dt->format('w'), + 'mon' => (int) $dt->format('n'), + 'year' => (int) $dt->format('Y'), + 'yday' => (int) $dt->format('z'), + 'weekday' => $dt->format('l'), + 'month' => $dt->format('F'), + 0 => (int) $dt->format('U'), + ); + } + /** * @return array an array with date info. */ @@ -123,7 +147,7 @@ class TDateTimeStamp 'yday' => (int) $dt->format('z'), 'weekday' => $dt->format('l'), 'month' => $dt->format('F'), - 0 => (int) $d + 0 => (int) $dt->format('U'), ); } -- cgit v1.2.3