On Thu, 25 Apr 2019, Allin Cottrell wrote:
On Thu, 25 Apr 2019, Artur Tarassow wrote:
> I am a bit puzzled by the following example where I first convert a date
> string into a timestamp before converting int back into a date string.
> However, instead of getting returned "2005:01", gretl returns
"2004:12".
I see what you mean. Apparently that's how strptime and strftime work: if you
just specify January 2005 on input strptime gives the epoch value for
midnight of December 2004/January 2005, which seems to belong to 2004 by
convention (of strftime, at least).
On further investigation: it seems that (a) the day of the month
defaults to zero, and (b) the zeroth day of the month is actually
taken to be the last day of the prior month. It's not enough to add
a second to the timestamp to push the date from Dec 2004 to Jan
2005: you have to add 24 hours.
I guess we should mention this point in our strptime/strftime
documentation. (It's not specific to gretl.)
Allin