Get the name of the day from Time.now

how can I get the name of the day from Time.now
Time.now.day is a number I would like to for example Mon...
thx

misiek wrote:

how can I get the name of the day from Time.now
Time.now.day is a number I would like to for example Mon...
thx

Hi misiek,
you can use strftime.

For example:

t = Time.now
puts t.strftime("%a") #=> Mon
puts t.strftime("%A") #=> Monday

ri strftime, will give you the complete list of options.

Cheers,
Antonio

ยทยทยท

--
Antonio Cangiano
My Ruby blog: http://www.antoniocangiano.com

Antonio Cangiano wrote:

misiek wrote:

how can I get the name of the day from Time.now
Time.now.day is a number I would like to for example Mon...
thx

Hi misiek,
you can use strftime.

For example:

t = Time.now
puts t.strftime("%a") #=> Mon
puts t.strftime("%A") #=> Monday

ri strftime, will give you the complete list of options.

Cheers,
Antonio

thank you it was super easy