summaryrefslogtreecommitdiff
path: root/framework/Data
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data')
-rw-r--r--framework/Data/TSimpleDateFormatter.php41
1 files changed, 41 insertions, 0 deletions
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