summaryrefslogtreecommitdiff
path: root/framework/Util
diff options
context:
space:
mode:
authorxue <>2006-04-25 01:31:43 +0000
committerxue <>2006-04-25 01:31:43 +0000
commit5ba6cd4be568f686d890835a77586077cde1a943 (patch)
tree54138a79e147bcfb0f6833d2d284a2f825c18f2a /framework/Util
parent1afc913c386bba8e6072c278b0eb4fd9818ab310 (diff)
Merge from 3.0 branch till 967.
Diffstat (limited to 'framework/Util')
-rw-r--r--framework/Util/TSimpleDateFormatter.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php
index 052e0074..2a3da63a 100644
--- a/framework/Util/TSimpleDateFormatter.php
+++ b/framework/Util/TSimpleDateFormatter.php
@@ -190,18 +190,20 @@ class TSimpleDateFormatter
/**
* Parse the string according to the pattern.
- * @param string date string to parse
+ * @param string|int date string or integer to parse
* @return int date time stamp
* @throws TInvalidDataValueException if date string is malformed.
*/
public function parse($value,$defaultToCurrentTime=true)
{
- if(!is_string($value))
+ if(is_int($value))
+ return $value;
+ else if(!is_string($value))
throw new TInvalidDataValueException('date_to_parse_must_be_string', $value);
if(empty($this->pattern)) return time();
- $date = $this->getDate(time());
+ $date = time();
if($this->length(trim($value)) < 1)
return $defaultToCurrentTime ? $date : null;