Is there an elegant way of printing the current time in Julia?
println("$(Dates.hour(now())):$(Dates.minute(now()))")
would inelegantly and incorrectly print 12.01pm as 12:1
.
As Julia Date and DateTime values are represented according to the ISO 8601 standard, 0000-01-01T00:00:00 was chosen as base (or "rounding epoch") from which to begin the count of days (and milliseconds) used in rounding calculations.
After March 31, only one new episode of Julia premieres every Thursday. That takes the show through May 5 with the season finale. Over the course of the series, viewers will also see how culinary television was born.
You could use Dates.format
to format your date/times (check here for formating instructions). For your given example:
>>> Dates.format(now(), "HH:MM")
"13:18"
>>> typeof(ans)
ASCIIString
The return of Dates.format
is a string itself (which is instantly printed in a REPL or you can print it with any printing function).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With