summaryrefslogtreecommitdiff
path: root/framework/Util/TSimpleDateFormatter.php
diff options
context:
space:
mode:
authorwei <>2006-08-30 08:35:39 +0000
committerwei <>2006-08-30 08:35:39 +0000
commitadab65ab49f125b39bf819abe68b0790cbf394df (patch)
tree280c6f994e1341f3915f71805fbcf22e5b059e5d /framework/Util/TSimpleDateFormatter.php
parentda895b1c97234c9640d94bef0e2027b9fc8a6a66 (diff)
Added TDateTimeStamp class for supporting time stamps outside 1970-2038 using float
Diffstat (limited to 'framework/Util/TSimpleDateFormatter.php')
-rw-r--r--framework/Util/TSimpleDateFormatter.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php
index 03ae7b7d..9c2975d5 100644
--- a/framework/Util/TSimpleDateFormatter.php
+++ b/framework/Util/TSimpleDateFormatter.php
@@ -168,12 +168,15 @@ class TSimpleDateFormatter
/**
* Gets the time stamp from string or integer.
* @param string|int date to parse
- * @return int parsed date time stamp
+ * @return array date info array
*/
private function getDate($value)
{
- if(is_int($value))
- return @getdate($value);
+ if(!is_string($value))
+ {
+ $s = Prado::createComponent('System.Util.TDateTimeStamp');
+ return $s->getDate($value);
+ }
$date = @strtotime($value);
if($date < 0)
throw new TInvalidDataValueException('invalid_date', $value);
@@ -199,7 +202,7 @@ class TSimpleDateFormatter
*/
public function parse($value,$defaultToCurrentTime=true)
{
- if(is_int($value))
+ if(is_int($value) || is_float($value))
return $value;
else if(!is_string($value))
throw new TInvalidDataValueException('date_to_parse_must_be_string', $value);
@@ -303,7 +306,8 @@ class TSimpleDateFormatter
else
{
$day = intval($day) <= 0 ? 1 : intval($day);
- return @mktime(0, 0, 0, $month, $day, $year);
+ $s = Prado::createComponent('System.Util.TDateTimeStamp');
+ return $s->getTimeStamp(0, 0, 0, $month, $day, $year);
}
}