Click here to Skip to main content
15,894,540 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I have DateTimePickers in my project. The format I have set is dd-MMM-yy

The problem is on some computers 12/10/11 is shown like 12-Oct-2011 and and some others the same shows as 10-Dec-2011. This is the same application that I have been running on different computers. Please advise how to fix this issue.

Thanks a lots.
Posted
Updated 3-Dec-11 12:45pm
v2
Comments
Richard MacCutchan 3-Dec-11 13:48pm    
You need to look at the Control Panel -> Regional Settings for the PC to see what format their short date is set to.
[no name] 3-Dec-11 18:45pm    
EDIT: added "code" block

I don't think the root cause of your problem can be with the DateTimePicker as they are a visual representation of a single immutable DateTime object which cannot be misinterpreted. No amount of custom string formatting could convert 12-Dec into 10-Oct. If you accept that then the cause must be elsewhere.

Almost certainly the value assigned to the DateTimePicker is derived from a string which is being parsed into a DateTime object incorrectly.

Alan.
 
Share this answer
 
Comments
Richard MacCutchan 4-Dec-11 3:54am    
+5. I have lost count of the number of questions posted on this subject this weekend. Do they not teach the basics any more?
When you set display configuration options for dates, and times in the operating system, these settings affect the Date dialog box and other operating system windows. The Windows software you use also adopts those settings as you enter dates and times in your documents. This articles describes how to change the way Windows XP displays dates, times, currency values, and numbers.

http://www.addictivetips.com/windows-tips/how-to-change-displayed-datetime-format-in-windows-xp-and-vista/[^]
http://support.microsoft.com/kb/307938[^]

If you need further information, please let me know.
 
Share this answer
 
v2
I had the same problem like you.. but I change the code.. I mean I did two version.. one dd-mm-yyyy and mm-dd-yyyy

try it..
 
Share this answer
 
Comments
Richard MacCutchan 4-Dec-11 3:53am    
Bad advice, you still have not fixed the underlying problem.

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