Display the day of month, day of year, month name and day name of the day 8 days from now.
ruby require 'date'
next_week = Date.today + 8
puts next_week.day # day of month
puts next_week.yday # day of year
puts next_week.strftime('%B') # month name
puts next_week.strftime('%A') # day name
require 'date'
next_week = Date.today + 8
puts next_week.day # day of month
puts next_week.yday # day of year
puts next_week.strftime('%B') # month name
puts next_week.strftime('%A') # day name
Submit a new solution for
ruby
There are 15 other solutions in
additional languages (
clojure,
cpp,
csharp,
fantom ...)