Let's say I have a DatePicker control and I allow my US clients to type something like "1/1" in it and hit tab go to next control. So I will parse that date for them as "01/01/2014" and some more similar patterns. But they are all US-based so they are


Now my question is about other formats? What If I want to support a country format that is like "yyyy/mm/dd" . How do those countries interpret such patterns?


You can use culture related format provider or directly use custom format when translating DateTime to String.

If you use VS 2010 and above, read this in MSDN Library starting from DateTime documentation:


And also this for custom date and time format:



I don't believe there is any standard way of how this should work, but I think you can assume if they are only entering two parts of the date those parts are the day and month (unless the system has a specific requirement otherwise). But you need to put a bit of intelligence in there, for example date format might be yyyy.mm.dd. You algorithm should ideally be generic based on locale.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.