As you can see here in struct tm
, days are 1 indexed while months are 0 indexed.
The same can be seen in other languages like Java.
What is the reason of doing this ?
The only purpose I can find is to make easier things like this :
const char *names[] = { "January", "February", ... };
names[date.tm_mon];