custom date/time formatting with i18n

Posted by – March 22, 2009

in helper

def show_date(date)
  return '' if date.nil? || date==0
  l(Time.at(date), :format => :ddate)
end

in config/locale/en.yml (for example)

date:
  formats:
  ddate: %d.%m.%Y

Closed