28 $this->dateFormats =& $onixCodelistItemDao->getCodes(
'List55');
30 parent::__construct();
38 return $this->
getData(
'publicationFormatId');
46 return $this->
setData(
'publicationFormatId', $publicationFormatId);
70 $this->
setData(
'dateFormat', $format);
78 return $this->
getData(
'dateFormat');
87 $codes =& $onixCodelistItemDao->getCodes(
'List163');
113 if (stristr($format,
'(H)')) {
126 if (stristr($format,
'string')) {
141 $dateFormatShort =
\Application::get()->getRequest()->getContext()->getLocalizedDateFormatShort();
144 $format = preg_replace(
'/\s*\(H\)/i',
'', $format);
154 $numbers = str_split($this->
getDate());
157 assert(count($numbers) == count(str_split($format)));
161 if (substr_count($format,
'Y') == 8) {
162 preg_match(
'/^(YYYY.*)(YYYY.*)$/', $format, $matches);
169 $formatCharacters = str_split($format);
170 $previousFormatCharacter =
'';
173 $containsMonth =
false;
175 for ($i = 0 ; $i < count($formatCharacters) ; $i ++) {
176 switch ($formatCharacters[$i]) {
184 $containsMonth =
true;
186 if ($i > 0 && $previousFormatCharacter != $formatCharacters[$i] && $previousFormatCharacter !=
'T') {
187 $thisDate .= $separator;
189 $thisDate .= $numbers[$i];
193 $previousFormatCharacter = $formatCharacters[$i];
198 if ($containsMonth) {
199 $thisDate = strftime($dateFormatShort, strtotime($thisDate));
202 $dates[] = $thisDate;
204 $numbers = array_slice($numbers, count($formatCharacters));
221 case '12':
return strtotime($date);
222 case '05':
return strtotime(
"$date-01-01");
223 case '01':
return strtotime(
"$date-01");
227 case '00':
return strtotime(substr($date, 0, 4) .
'-' . substr($date, 4, 2) .
'-' . substr($date, 6, 2));