I ran into a bug recently on a job importing dates from a feed of events into a MySql database - I was using DateTime.Parse in C# to bring them in, then formatting them as MySql DateTimes. Of course, what I didn’t notice until later was that the dates were from the UK, and they came in as day/month/year, while my computer was set for month/day year, so March 12 was being read (and saved) as December 3.
The fix was easy - just specify the format when you parse - and probably should have been included in all DateTime.Parse calls I’ve ever made:
dt = DateTime.Parse(myDate,
System.Globalization.CultureInfo.CreateSpecificCulture(”en-GB”).DateTimeFormat);
This got me to thinking… Since the project’s coming down to a crunch (so what else is new), I thought I could do my own parse bug, and say we thought the month and day fields were backwards on the schedule.
Sadly, the clients are one step ahead - they made the due date April 4.
04/04
Bastards.
Post a Comment