Click here to Skip to main content
15,887,251 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Helloo, I have a DTP control. I usually fetch the datetime value as '2010-03-27 00:00:00' from DB. But i wanna put the date in my DTP control in this format "27/03/2010"... I able to make the date as "27/03/2010" But when i put this in DTP control..throwing error...help me...
Posted
Updated 11-Dec-10 21:56pm
v2
Comments
Abdul Quader Mamun 12-Dec-10 3:56am    
Spelling check.

Well, you didn't tell us what the exception was that you're seeing, so I have to guess at a correct answer.

Create a DateTime object, set it to your date time, and then set the DateTimePicker to the DateTime object you created.
 
Share this answer
 
Comments
krishna kishore58 9-Dec-10 5:29am    
can u suggest me bit with code...
#realJSOP 9-Dec-10 5:43am    
Really? You can't work that out on your own? Aren't you a programmer?
krishna kishore58 9-Dec-10 6:06am    
Nothing like that, i never worked with DTP object n have no idea...ofcourse if i try from net defineately i ll get...dats not an issue... but iam running out of time...so thought u m8 be knowing..n asked u..okay...
wizardzz 9-Dec-10 10:39am    
Wow, running out of time? This is very simple, John's answer should be enough for ANYONE with a computer, 2 fingers, and half of a programmer's brain to elaborate on. I swear the question and answer section of this site becoming the web's haven for shotty outsource workers to complete projects they promised they could do. I say this based on the frequency of relatively low level questions posted by krishna (26).
fjdiewornncalwe 11-Dec-10 17:12pm    
Not that hard really... A DateTimePicker control can take a DateTime object as a value... Even I could figure that out.
why not use custom format in dtp like yyyy/mm/dd or anyhow you want?
 
Share this answer
 
Comments
JOAT-MON 11-Dec-10 17:49pm    
Right, otherwise the DTP will utilize whatever cultural context it is running on to determine the display format.

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