You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can also use the `dateformat""` string macro. This macro creates the `DateFormat` object once when the macro is expanded and uses the same `DateFormat` object even if a code snippet is run multiple times.
128
+
Alternatively, use broadcasting:
129
129
130
130
```jldoctest
131
-
julia> years = string.(2000:10000);
131
+
julia> years = ["2015", "2016"];
132
+
133
+
julia> Date.(years, DateFormat("yyyy"))
134
+
2-element Vector{Date}:
135
+
2015-01-01
136
+
2016-01-01
137
+
```
132
138
133
-
julia> dates = Date.(years, dateformat"yyyy");
139
+
You can also use the `dateformat""` string macro. This macro creates the `DateFormat` object once when the macro is expanded and uses the same `DateFormat` object even if a code snippet is run multiple times.
134
140
135
-
julia> dates[1:3]
136
-
3-element Vector{Date}:
137
-
2000-01-01
138
-
2001-01-01
139
-
2002-01-01
141
+
```jldoctest
142
+
julia> for i = 1:10^5
143
+
Date("2015-01-01", dateformat"y-m-d")
144
+
end
140
145
```
141
146
142
147
As well as via the constructors, a `Date` or `DateTime` can be constructed from
0 commit comments