⚲
Project
General
Profile
Sign in
Register
Home
Projects
Imprint + Privacy Policy
Help
Search
:
CDO
All Projects
CDO
Overview
Activity
News
Wiki
Forums
Files
Documentation
Download (428 Bytes)
RE: convert monthly averages to monthly totals
ยป m2s.rb
Ralf Mueller
, 2019-11-07 11:07
require
'time'
years
=
(
2001
..
2009
)
months
=
(
1
..
12
)
years
.
each
{
|
year
|
months
.
each
{
|
month
|
dateStart
=
DateTime
.
new
(
year
,
month
,
1
,
0
,
0
,
0
)
if
12
!=
month
then
dateEnd
=
DateTime
.
new
(
year
,
month
+
1
,
1
,
0
,
0
,
0
)
else
dateEnd
=
DateTime
.
new
(
year
+
1
,
1
,
1
,
0
,
0
,
0
)
end
diffInSeconds
=
dateEnd
.
strftime
(
'%s'
).
to_i
-
dateStart
.
strftime
(
'%s'
).
to_i
pp
[
diffInSeconds
,
dateStart
.
to_s
,
dateEnd
.
to_s
]
}
}
(1-1/1)
Loading...