FaheemAhmadGul
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why try... you should to myDate.ToString("MM/dd/YYY Y") to get the result you need.
ASKER
Many thanks