Click here to Skip to main content
15,902,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can any one provide a date picker which will change the date format dynamically means when i give dd/mm/yyyy it must work and if i give mm/dd/yyyy format it must display in this format

i give dd/mm/yyyy it must work and if i give mm/dd/yyyy format it must display in this format
You can have only one format defined at one time.

Let me tell you the reason why. It's a logical one:
Days can be between 1-12 and Months too can be between 1-12. If you don't define the format and expect the code or control to assume the format by itslef based on the date then it wil get confused for dates like 02/03/2010, 08/03/2010, 04/04/2010, etc

Hope you got it. Thus, you need to fix the format of calenar from before. If needed, format can be defined in a config file and it can be picked by calendar at runtime.
Share this answer
Rajesh Yerramsetti 26-Feb-11 5:38am    
it must accept multiple format
Sandeep Mewara 26-Feb-11 5:39am    
What do you mean by MUST? I gave a reason and tried to exlain why not.
Espen Harlinn 26-Feb-11 9:38am    
My 5 - He can always use a sequence of TryParse, but it's not something I would be comfortable with :)
How do you expect it to do that?

If you give it 12/07/2011 should it assume that is December the 7th? or July the 12th?
Share this answer
Rajesh Yerramsetti 26-Feb-11 5:37am    
it must accept multiple formats
OriginalGriff 26-Feb-11 5:40am    
Which date am I thinking of when I type this: 09/06/2010
You have one guess.
Sandeep Mewara 26-Feb-11 5:40am    
:doh: Inspite of me explaining him why it should not be done, he comes and say "it MUST".
OriginalGriff 26-Feb-11 5:41am    
Some people just aren't easy to help! :laugh:
Sandeep Mewara 26-Feb-11 5:43am    
You bet! :laugh:
Please try the following link:

If i misunderstand your question, please feel free to correct me.I hope the above information will be helpful. If you have more concerns, please let me know.

If this would be really helpful to you then don't forgot to Vote and Make Answer as Accepted.
Share this answer
Sandeep Mewara 26-Feb-11 5:41am    
I am not sure of OP, but I AM confused and not clear of your answer. How are you planning to say which format at runtime?

Tell me, which format date is this: 06/05/2010?
Monjurul Habib 26-Feb-11 6:35am    
If the format of your date picker is mm/dd/yyyy then it is definitely "June 5th 2010". Its totally depends on your customization, which format your are using.And you need not to worried about this coz the date picker will decide this depending on the format.
Sandeep Mewara 26-Feb-11 6:39am    
Thats the whole question here. He wants to have two formats at a time.
We suggested you have to fix a format.

You see now, what we mean?
Monjurul Habib 26-Feb-11 6:47am    
ok i misunderstood the question.sorry Sandeep.
Sandeep Mewara 26-Feb-11 6:54am    
Hey, thats Ok. Just wanted to point it to you too such that others don't get confused in future. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900