TimeArray 日期问题

TimeArray Dates Issue

我想问一下是否有人知道如何从 TimeArray table 中获取日期 table 例如。 36x1 TimeArray{Float64,1} 1980-12-31 至 2015-01-01

1980-12-31 | 0.94

1981-12-31 | 0.37

1982-12-31 | 0.12

1983-12-31 | 0.64

2012-12-31 | 0.43

2013-12-31 | 0.81

2014-12-31 | 0.88

2015-01-01 | 0.55

如果您将此 table 读入矩阵 x,其中日期位于第一列,那么这将遵循手册中的模式 http://docs.julialang.org/en/release-0.4/manual/dates/ :

df = Dates.DateFormat("y-m-d"); map(u -> Date(u,df), x[:,1])

我不知道那些 TimeArray 是从哪里来的,但是因为你提到它们是 Float64 类型,我认为格式可能是 UnixDateTime,所以如果它是真的那么你可以将它们转换为 julia DateTime 如下: juliadatetime=[Dates.unix2datetime(t) for t in timearray] 然后提取你想要的 ymd=[Dates.yearmonthday(t) for t in juliadatetime]