Get the current date and time

From Cuis CookBook
Jump to navigation Jump to search

Date

One can obtain the current date, represented as an instance of Date, like this:

Date today.   "=> 15 August 2021 "

Time

The time of the day, as an instance of Time, can be obtained like this::

Time now.      "=> 3:15:04.483133 pm "

Both Date and Time in one go

A timestamp including the time and the date, an instance of DateAndTime, can obtained like this

DateAndTime now.    "=> 2021-08-15T15:15:26.957885+00:00 "