.net - 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 (with month and day) that I want to convert to a C # date time . Naturally, there can not be a birthdate in future, but is there an existing facility for converting a two-digit year into a four-digit year?

  constant int GetFourDigitYear (int year, int maxyear) {System.Globalization.GregorianCalendar cal = New system.Globalization.Gregorian calendar (); Cal.TwoDigitYearMax = maxyear; Return callout Force degree (year); }  

Max-Year should be the current four digit year.


Edit : OP Solution:

Static GetFourDigitYear (int year, int pivot) {System.Globalization.GregorianCalendar cal = New System.Globalization.GregorianCalendar (); Cal.TwoDigitYearMax = New DateTime Year + (100-fog); Return callout Force degree (year); }

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -