toMilliseconds() method in Time class returns wrong values?


#1

I’m using Projucer/Juce Huckleberry 5.2.0 with Visual Studio 2015 and im trying the following simple code

Time tLogTime(2018, 1, 4, 14, 1);
int64 msecsEpoch = tLogTime.toMilliseconds();

The correct value for msecsEpoch shall be 1515067260000
What i am getting back though is 1517745660000

I’m i missing something or this is a bug?

link to verify the value im mentioning above: https://currentmillis.com/

Thanks in advance.


#2

You are off by 31 days. Note that Time’s month is starting January = 0…
Are you comparing to a value when starting with January=1?


#3

thanks Daniel.
I just noticed the below:

“month the month, in the range 0 to 11”

Indeed this was the problem in my code. The “1” in my call corresponds to February instead of January.