Hi all
I have a string representing the expiry date of a credit card - that should be in MMYY format e.g. "0203". I need to ensure that this is a valid date and that it is in "MMYY" format.
I tried the following:
[tt]_ccexpiry = DateTime.Parse(_ccexpiry).ToString("MMyy"[/tt]
but it returns the following error:
System.SystemException: {"String was not recognized as a valid DateTime."}
In VB6 there is a function called Format() where I could have said something like:
[tt]Format(_ccexpiry, "MMyy"[/tt]
to ensure that the string was in the correct format.
Is there any way that I could do something similar in C#?
Thanks as always
Craftor
I have a string representing the expiry date of a credit card - that should be in MMYY format e.g. "0203". I need to ensure that this is a valid date and that it is in "MMYY" format.
I tried the following:
[tt]_ccexpiry = DateTime.Parse(_ccexpiry).ToString("MMyy"[/tt]
but it returns the following error:
System.SystemException: {"String was not recognized as a valid DateTime."}
In VB6 there is a function called Format() where I could have said something like:
[tt]Format(_ccexpiry, "MMyy"[/tt]
to ensure that the string was in the correct format.
Is there any way that I could do something similar in C#?
Thanks as always
Craftor