How can I get the name of the day in Ruby?
For eg. something like that:
a = Date.today
a.day_name
# => Tuesday
the only thing I could find was .wday
but that only returns for the number of the day in the week
a.wday
# => 2
Time.now.strftime("%A")
# => "Tuesday"
or
Date.today.strftime("%A")
# => "Tuesday"
Weekday:
%A - The full weekday name (``Sunday'')
%^A uppercased (``SUNDAY'')
%a - The abbreviated name (``Sun'')
%^a uppercased (``SUN'')
Source: strftime @ apidock.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With