C# Programming
08-19-2011, 04:13 PM
Hi,
I have a DateTime object, and my code correctly sets the year/month and day from a DateTime picker controll on my form.
When I return the object and use .ToString, I get the following output:
19/08/2011 00:00:00
Now, I am not using or setting the time, so it is always 00:00:00.
My question is how do I remove this time part from the string?
1) Is there a method from the DateTime object to do this, or,
2) Do I need to do this once I convert to string, and if so how?
Thank you in advance,
Regards,
Stephen
**EDIT Found out. .ToString(format code) **
modified on Friday, August 19, 2011 8:00 AM
I have a DateTime object, and my code correctly sets the year/month and day from a DateTime picker controll on my form.
When I return the object and use .ToString, I get the following output:
19/08/2011 00:00:00
Now, I am not using or setting the time, so it is always 00:00:00.
My question is how do I remove this time part from the string?
1) Is there a method from the DateTime object to do this, or,
2) Do I need to do this once I convert to string, and if so how?
Thank you in advance,
Regards,
Stephen
**EDIT Found out. .ToString(format code) **
modified on Friday, August 19, 2011 8:00 AM