ruby can display date and time. In this article you will learn how to deal with date and time in ruby.
Date is default, but time cannot go back earlier than 1970. Why? that’s when the logic was added to computers.
The program below is an example of date and time in ruby. The formatting is explicitly defined (%y for year, %m for month etc).
The code above displays the date and time. You can use an alternative formatting if you want..
The output will be similar to this:
Date : 2018-06-07
Time : 10:38:01
- Display date in DD/MM/YYYY format