On the client side, I’m validating strings that will be pushed to the .NET framework and I need to know what formats will be valid and recognized by .NET Framework.
http://msdn.microsoft.com/en-us/library/1k1skd40.aspx lists the formats recognized but doesn’t answer all of my questions.
For Date:
Are single digit day/month valid?
Are 2 digit years valid?
For Time:
What formats for am/pm are valid? Possible strings I can see are: (‘a’,’p’,’ a’,’ p’,’am’,’pm’,’ am’,’ pm’)
.NET can parse dates with single day/month and 2 digit years without a problem.
You need to use a custom format string for that.
If you want to test for multiple formats, you can pass an array of format strings as the second parameter: