# Changing the granularity spec from 'year' to 'duration with milliseconds' changes timestamp origin

Hello,
When I specify the granularity as “year” then the timestamp in result are like [2013-01-01T00:00:00Z, 2014-01-01T00:00:00Z etc ]
And when I change it to
“granularity”: {
“duration”: 31536000000.0,
“type”: “duration”
},

the timestamp in result are something like this [2012-12-21T00:00:00.000Z, 2013-12-21T00:00:00.000Z etc]

Why is it so?

-Rajnandini

Hi Rajnandini,
With duration granularity it is assuming all intervals are of 365 days, which is not correct as leap years have 366 days.

(y)

• Rajnandini

since the duration specified for the duration granularity you mentioned is 31536000000 ms == 365 days != 1 year always.

I thought it would be interesting to prove this:

Unix times are based on 0 being midnight on 1970-01-01

2013-01-01 is 43 years after that start.

43 years * 31536000 (seconds in 365 days) = 1356048000

Converting that timestamp to a date gives you 2012-12-21

Magic!

Cool. Thanks for clarification.
-Rajnandini