Q:

Write a Ruby program to display the current date and time

0

 Write a Ruby program to display the current date and time

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ruby Code:

require 'date'
current_time = DateTime.now
cdt = current_time.strftime "%d/%m/%Y %H:%M"
puts "Current Date and Time: "+cdt

Output:

Current Date and Time: 27/12/2017 10:30

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now