summaryrefslogtreecommitdiff
path: root/framework/Util/TSimpleDateFormatter.php
diff options
context:
space:
mode:
authorxue <>2006-08-30 12:33:43 +0000
committerxue <>2006-08-30 12:33:43 +0000
commit1f560ccd8a9e21871dbedd548fc97f231131c771 (patch)
tree90d054108a0bce4668ca16d425655b22c99ed6d3 /framework/Util/TSimpleDateFormatter.php
parentf4482f9c17825b63242fee42252e097dd85f53c5 (diff)
merge from 3.0 branch till 1363.
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);
}
}