2-digit-year

Converting a year from 4 digit to 2 digit and back again in C#

My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I a currently processing: I put a DropDownList of the 4-digit year on the page. I validate the expiration date in a DateTime field to be sure that the expiration date being passed to the CC processor isn't expired. I send a two-d...

Preferred method for handling Y2K date conversions?

Is there a preferred algorithm for converting a 2-digit year into a 4-digit year? I have a 2-digit birth date (along with month and day) that I want to convert to a C# DateTime. Obiviously, birthdates cannot be in the future, but is there an existing facility in .NET to convert a 2-digit year into a four-digit year? ...

Win32: How to prevent DateTimePicker from accepting 2-digit years?

Microsoft's DateTimePicker common control shows ShortDate's according to the configured Locale settings. The customer's computer is configured with a 2-digit year ShortDateFormat (d/M/yy), so the DateTimePicker shows 2-digit years: When the user puts focus in the year block of the datetime picker, Microsoft points out the issue, and s...

2 digit years using strptime() is not able to parse birthdays very well.

Consider the following birthdays (as dob): 1-Jun-68 1-Jun-69 When parsed with Python’s datetime.strptime(dob, '%d-%b-%y') will yield: datetime.datetime(2068, 6, 1, 0, 0) datetime.datetime(1969, 6, 1, 0, 0) Well of course they’re supposed to be born in the same decade but now it’s not even in the same century! According to the do...