Please ignore this report. The code performs as documented. The reason I submitted it was that code which had been working for several months stopped working late last night (after midnight). While investigating it, I noticed the way gmtime/localtime return years and suspected it was the problem. In fact, the cause of the error was that code which was doing date arithmetic did not correct the values returned by gmtime before using them. It was the month that caused the error. All dates after 1st Aug were accepted with the month offset by one until 31 Oct, when the offset produces 31 Sep and is flagged illegal. Apologies, Derek.