Home > ruby > The ruby code to find which weekday is current day

The ruby code to find which weekday is current day

At first, I failed to find which weekday is today by following codes:

timetoday = Time.now

if timetoday =~ /Fri/
puts “Friday”
end

I found in the internet that following codes works:

timetoday = ” ”
timetoday = Time.now.to_s()

if timetoday =~ /Fri/
puts “Friday”
end



Categories: ruby Tags:
  1. No comments yet.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word