diff options
author | ctrlaltca <> | 2013-01-06 19:16:09 +0000 |
---|---|---|
committer | ctrlaltca <> | 2013-01-06 19:16:09 +0000 |
commit | ea00eb2ea27613491eb517be9659059696fb335b (patch) | |
tree | 57c1ce76ec17816effe67a1a8ae7b8500a5073aa /framework/Util/TDateTimeStamp.php | |
parent | b5f4be7ea0b8bdf220297893a907fe59c017fbd5 (diff) |
backpotder r3238, r3239 to trunk/
Diffstat (limited to 'framework/Util/TDateTimeStamp.php')
-rw-r--r-- | framework/Util/TDateTimeStamp.php | 26 |
1 files changed, 25 insertions, 1 deletions
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 @@ -105,6 +105,30 @@ class TDateTimeStamp /** * @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. + */ function getDate($d=false,$fast=false) { if ($d === false) return getdate(); @@ -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'), ); } |