I'm using Regex and I want to convert dd/mm/yy
into full dd/mm/yyyy
.
For example. User enters his date of birth: 01/11/94
The program converts the year 94
into 1994
.
Now if the user inserts date of birth: 01/11/09
The program converts the year 09
to 01/11/2009
because it can't be 1909
. Unless you a vampire.
And now if the user inserts the date of birth: 01/11/15
The program let's the user to continue to type because its the current year. 2015
. Incorporation of current date validity check function here would be necessary.
I have come this far but I need help making it fully functional. If you'd like to help, I can show you somewhat of the code I've created.
There are tools designed to do this which provide more value than regex processing.
The tool to use is
DateTime
with its ParseExact with the appropriate date format specifications to do the converstion.Here are four examples with the result in the comment: