vb.net string remove last char...

ofcourse the  sDate dosen´t get the value like this but just to show..
sDate = "2005-03-04 00:00:00"        




sDate = frmMain.uxStartDateLine.EditValue.ToString
sDate.Remove(sDate.Length - 9)            '<----- This dosen´t work
       


I want my sDate to have this value...  "2005-03-04"   nothing more....  tips..


I can´t get it to work..


2005-03-04 00:00:00
kavvisAsked:
Who is Participating?
 
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
Try this way:
sDate = sDate.Remove(sDate.Length - 9)
0
 
Om PrakashCommented:
sDate = frmMain.uxStartDateLine.EditValue.ToString
sDate = sDate.Remove(sDate.Length - 9)          
0
 
jppintoCommented:
DateTime.sDate.ToString("yy-MM/dd")
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jppintoCommented:
sDate.ToString("d")
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Better this way:
        Dim initialData As String = "2005-03-04 00:00:00"
        MessageBox.Show(DateTime.Parse(initialData).ToShortDateString)

Open in new window

0
 
kavvisAuthor Commented:
Thanks for that quick replay!
And for everyone that help me to!

This solution was what I needed.. I´m a bit angry of my selves because I almost get it my selves.. but now I will never forgott it!

Thank you!
0
All Courses

From novice to tech pro — start learning today.