Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to set date format in checkbox listbox items in c#
Posted
Comments
Santhosh Kumar Jayaraman 31-Jan-13 6:08am    
what format you want?
[no name] 31-Jan-13 6:10am    
what you want, please clarify.
Balamurugan1989 31-Jan-13 6:10am    
In Which Format you need to set date???Elaborate your Questions???
J.Surjith Kumar 2-Feb-13 8:33am    
Explain in detail. Improve question is there to edit the question.

If you are binding it with some data source then you are required to select the date format at the time of data selection (i.e. if db source is SQL then format it at SQL level)
 
Share this answer
 
If you want to Display the System date means you should follow the below code,

textBox1.Text = DateTime.Now.ToShortDateString();
textBox2.Text = DateTime.Now.ToShortTimeString();


It depends on Textbox or listbox. I have written for displaying the system time in textbox.
 
Share this answer
 
v3
VB
textBox1.Text=DatTime.Now.ToString("dd-MM-yyyy")
02-02-2013

textBox2.Text=DatTime.Now.ToString("dd-MMM-yyyy")
02-Feb-2013
 
Share this answer
 

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