Get the name of the day from Time.now


#1

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


#2

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


#3

Antonio C. wrote:

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