| Новости | FAQ | Авторы | Документация | В действии | Библиотека |
| Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
nkostya 18.01.2005 18:22 / 18.01.2005 18:25
Parser v.3.1.4# $Id: dtf.p,v 1.11 2004/06/28 07:51:57 misha Exp $
@parse[date]
^if($date is date){
$result[$date]
}{
^try{
^if(!def $date || ($date is 'string' && ^date.length[] < 4)){
^throw[dtf.parse;Wrong date string format]
}
$result[^date::create[$date]]
}{
$exception.handled(1)
$result[^date::now[]]
}
}
#end @parse[]
@format[fmt;date;locale]
$date[^parse[$date]]
$sdfsd[${date.day}-${date.month}-${date.year}]
^sdfsd.save[/_.txt]
^if(!def $locale){$locale[$self.locale]}
$result[^fmt.match[%(.)][g]{^switch[$match.1]{
^case[%]{%}
^case[e]{$date.day}
^case[d]{^date.day.format[%02d]}
^case[c]{$date.month}
^case[m]{^date.month.format[%02d]}
^case[h]{$locale.month.[$date.month]}
^case[Y]{$date.year}
^case[y]{$tmp($date.year % 100)^tmp.format[%02d]}
^case[w]{$date.weekday}
^case[a;A]{$locale.weekday.[$date.weekday]}
^case[D]{^date.month.format[%02d]/^date.day.format[%02d]/$date.year}
^case[H]{^date.hour.format[%02d]}
^case[M]{^date.minute.format[%02d]}
^case[i]{^date.minute.format[%02d]}
^case[S]{^date.second.format[%02d]}
^case[T]{^date.hour.format[%02d]:^date.minute.format[%02d]:^date.second.format[%02d]}
}}]При попытке ^dtf:format[%e %c %Y %H %M;$update_time], где $update_time переменная типа date получаю вывод в нужном формате за текущую дату (now), а не за заданную.