From 54572d1e4a5914e44bcd35fa9406ea72a8f2066f Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 19 Feb 2006 22:25:23 +0000 Subject: Update TRatingList and date picker. --- framework/Data/TSimpleDateFormatter.php | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'framework/Data') diff --git a/framework/Data/TSimpleDateFormatter.php b/framework/Data/TSimpleDateFormatter.php index d2f78b37..f6c04027 100644 --- a/framework/Data/TSimpleDateFormatter.php +++ b/framework/Data/TSimpleDateFormatter.php @@ -121,6 +121,47 @@ class TSimpleDateFormatter return str_replace(array_keys($bits), $bits, $this->pattern); } + public function getMonthPattern() + { + if(is_int(strpos($this->pattern, 'MMMM'))) + return 'MMMM'; + if(is_int(strpos($this->pattern, 'MMM'))) + return 'MMM'; + if(is_int(strpos($this->pattern, 'MM'))) + return 'MM'; + if(is_int(strpos($this->pattern, 'M'))) + return 'M'; + } + + public function getDayPattern() + { + if(is_int(strpos($this->pattern, 'dd'))) + return 'dd'; + if(is_int(strpos($this->pattern, 'd'))) + return 'd'; + } + + public function getYearPattern() + { + if(is_int(strpos($this->pattern, 'yyyy'))) + return 'yyyy'; + if(is_int(strpos($this->pattern, 'yy'))) + return 'yy'; + } + + public function getDayMonthYearOrdering() + { + $ordering = array(); + if(is_int($day= strpos($this->pattern, 'd'))) + $ordering['day'] = $day; + if(is_int($month= strpos($this->pattern, 'M'))) + $ordering['month'] = $month; + if(is_int($year= strpos($this->pattern, 'yy'))) + $ordering['year'] = $year; + asort($ordering); + return array_keys($ordering); + } + /** * Gets the time stamp from string or integer. * @param string|int date to parse -- cgit v1.2.3