Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/brdata/time_portuguese.rb
Instance Method Summary collapse
-
#strftime(format) ⇒ Object
Formata a hora usando nomes de dias e meses em Portugues Exemplo: hora = Time.new hora.strftime(“%B”) ==> “Janeiro” forum.rubyonbr.org/forums/1/topics/261.
- #strftime_nolocale ⇒ Object
-
#to_s_br ⇒ Object
Retorna a hora no padrao brasileiro.
Instance Method Details
#strftime(format) ⇒ Object
Formata a hora usando nomes de dias e meses em Portugues Exemplo: hora = Time.new hora.strftime(“%B”) ==> “Janeiro” forum.rubyonbr.org/forums/1/topics/261
18 19 20 21 22 23 24 25 |
# File 'lib/brdata/time_portuguese.rb', line 18 def strftime(format) format = format.dup format.gsub!(/%a/, Date::ABBR_DAYNAMES[self.wday]) format.gsub!(/%A/, Date::DAYNAMES[self.wday]) format.gsub!(/%b/, Date::ABBR_MONTHNAMES[self.mon]) format.gsub!(/%B/, Date::MONTHNAMES[self.mon]) self.strftime_nolocale(format) end |
#strftime_nolocale ⇒ Object
2 |
# File 'lib/brdata/time_portuguese.rb', line 2 alias :strftime_nolocale :strftime |
#to_s_br ⇒ Object
Retorna a hora no padrao brasileiro
Exemplo:
hora = Time.new
hora.to_s_br ==> "27/09/2007 13:54"
9 10 11 |
# File 'lib/brdata/time_portuguese.rb', line 9 def to_s_br self.strftime("%d/%m/%Y %H:%M") end |