Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get date in Julia

Tags:

julia

I search the docs but I cannot find a function to get today's date.I probably am missing something fairly obvious.

I just need something like

julia> today()
2014-06-25

julia> string(today())
"2014-06-25"
like image 256
pezpezpez Avatar asked Jun 25 '14 19:06

pezpezpez


2 Answers

Your exact sketch now works precisely as you've written it after using Dates. The Dates module is a part of the standard library and thus is available by default:

julia> using Dates

julia> today()
2020-08-20

julia> string(today())
"2020-08-20"

(note: this answer has been edited and updated for version 1.0+; this question pre-dates the existence of the Dates stdlib.)

like image 138
mbauman Avatar answered Nov 13 '22 19:11

mbauman


You can now use:

julia> Dates.today()
2015-07-15

julia> string(Dates.today())
"2015-07-15"
like image 42
tiho Avatar answered Nov 13 '22 21:11

tiho