Click here to Skip to main content
16,020,811 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

how can i remove the space from date of the datetimepicker control.
ex:-
suppose the date is: 11/02/2010.

after executing it is showing that.

11/ 2/2010.

i want to remove the space at 2 or i should include 0 there.

help me.

in windows applications(c#.net3.0)

regards,
nagaraju
Posted
Comments
shakil0304003 2-Nov-10 10:16am    
Not Clear!

Use a CustomFormat string.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat.aspx[^]

It seems it may not be easy to remove the space, but you could get a zero there by using this format string: MM/dd/yyyy
 
Share this answer
 
v2
Example (for should include 0 & remove the space at 2):
label1.Text = dateTimePicker1.Value.ToString("MM/dd/yyyy");
label1.Text += "\n" + dateTimePicker1.Value.Month + "/" + dateTimePicker1.Value.Day + "/" + dateTimePicker1.Value.Year;
 
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