How to use datetime in Julia?

I am using Julia 0.3.0 on Windows 8.1

These examples are taken from a date guide https://github.com/quinnj/Datetime.jl/wiki/Datetime-Manual

I tried this:

julia> using datetime
Warning: requiring "datetime" did not define a corresponding module.

julia> date(2013,7,1)
ERROR: date not defined

julia> today()
ERROR: today not defined

julia> dt = date(2013,7,1)
ERROR: date not defined

julia> dt = datetime(2012,6,30,18,59,50,0,CST)
ERROR: datetime not defined

julia> datetime(2013,7,1,12,0,0,0,UTC)
ERROR: datetime not defined

How to create a datetime object? I understand that DateTime will be deprecated and that Dates will become the new datetime module. I added this package, but I can not find any instructions on how to use it.

+4
source share
3 answers

The first line should be using Datetime, after installing the Datetime c package Pkg.add("Datetime").

julia> using Datetime

julia> date(2013,7,1)
2013-07-01

julia> today()
2014-09-01

julia> dt = date(2013,7,1)
2013-07-01

julia> dt = datetime(2012,6,30,18,59,50,0,CST)
2012-06-30T18:59:50 CDT

julia> datetime(2013,7,1,12,0,0,0,UTC)
2013-07-01T12:00:00 UTC

Prior to Julia 0.4, you should stick with this.

+2
source

, - ( duckduckgo): julia Datetime , julia 0.4-dev , .

, (julia 0.5, 0.6) Base.Dates,

Base.Dates.today()

import Base.Dates; ()

+1

I have found a solution. Uninstall / reinstall Julia to get rid of the Datetime package. run Pkg.add ("Dates"), the user guide is here docs.julialang.org/en/latest/manual/dates

0
source

All Articles