...
Excerpt |
---|
|
If we want to create a list of dates such as [19930601, 19930701, ..., 20160701, 20160801], where for each year we have the first day of the same monthseach month, the following code snippet will create such a list |
...
Step-by-step guide
If we want to create a list of dates such as [19930601, 19930701, ..., 20160701, 20160801], where for each year we have the first day of the same months, the following code snippet will create such a list:
Tabs Container |
---|
|
Tabs Page |
---|
|
Code Block |
---|
| d1 = 1993-06-01
d2 = 2016-08-01
d = d1
datelist = []
while d <= d2 do
datelist = datelist & [d]
d = addmonths(d, 12)
end while
print(datelist) |
|
Tabs Page |
---|
|
Code Block |
---|
| import metview as mv
from datetime import datetime
d1 = datetime(1993,6,1)
d2 = datetime(2016,8,1)
d = d1
datelist = []
while d <= d2:
datelist.append(d)
d = mv.addmonths(d, 1)
print(datelist) |
|
|
Related articles
Content by Label |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | ~usa |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label = "kb-how-to-articlemetview-faqs" and label = "date" and type = "page" and space = "UDOC" |
---|
labels | kb-how-to-article |
---|
|
...