How to trim the last 6 characters from a DateTime Variable myDate = "02/03/2011 22:44" so that myNewDate ="02/03/2011"

I have a DateTime Variable myDate in Visual Basic Project in Visual Studio 2010.
I need code that will remove (trim)  the last 6 characters of the text contained in this variable and store the remaining characters in a new DateTime variable myNewDate.
So if
myDate = “02/03/2011 22:44”
after triming
myNewDate = “02/03/2011”
That is basically I have removed the characters representing time from myDate.
Thank you for your help in anticipation
LVL 1
FaheemAhmadGulAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
PagodNaUtakConnect With a Mentor Commented:
myDate = “02/03/2011 22:44”
MyNewDate = DateTime.Parse(myDate).ToShortDateString();
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
why try... you should to myDate.ToString("MM/dd/YYYY") to get the result you need.
0
 
FaheemAhmadGulAuthor Commented:
Many thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.