Time::formatted() returning offset by one month?


#1

This seems like it must be something at my end as I’m sure it’d have been noticed before:

an example:

Time t(2006, 11, 1, 0, 0);
String st = t.formatted(T("%Y%m%d"));

returns an st of 20070101

a trace disappears off into untraceable methods, but it looks like things are going wrong beyond JUCE.

This is on Windows.

What’s going on?


#2

That’s very strange… As you say, it’s not really a juce thing, because all the numbers just get passed to the standard c library. Maybe it’s got the timezone screwed up or something and that’s throwing off the maths…?


#3

I’m following this up, just in case anyone else experiences something similar:

I don’t currently have time to dig down to the actual culprit, but as far as I can tell, the date offset is happening only in app that also uses SQLite and DCMTK - which makes me think that it is being caused by some odd interplay of libraries or includes.

It actually seems to be confusion between zero and non-zero indexed days and months. Maybe one day if I care, I’ll try and find out why. Not a JUCE problem though, and in my case, easily solvable but just brute force building the date string.


#4