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
35 36 37 38 39 40 41 42 |
# File 'lib/brdata/time_portuguese.rb', line 35 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
19 |
# File 'lib/brdata/time_portuguese.rb', line 19 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"
26 27 28 |
# File 'lib/brdata/time_portuguese.rb', line 26 def to_s_br self.strftime("%d/%m/%Y %H:%M") end |