Click here to Skip to main content
11,417,750 members (47,288 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET .NET4
I am working on a WPF project with a datepicker and I can't seem to figure out how to eliminate the time stamp from the output. I only need the .SelectedDate returned.

In my code I am converting the date to a string
if DatePicker1.ToString <> "" then
My problem is that the returned string is "2/25/2013 12:00:00 AM"
I only wish to get "2/25/2013" without the time code.
How do I do this?
Posted 25-Feb-13 6:39am
Edited 25-Feb-13 7:06am
richcb at 25-Feb-13 11:40am
That is not a question. Please elaborate and be specific when asking your question.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I wasn't able to delete the solution, but here is an update "I solved it myself" solution...
If DatePicker1.ToString <> "" Then qq = Left(DatePicker1.ToString, Len(DatePicker1.ToString) - 11) : PutText("DATEIN")
CHill60 at 25-Feb-13 12:09pm
You've posted this as a Solution instead of using the Improve Question link. As this is your own posting you should be able to delete this solution - otherwise no one will see it as requiring an answer
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Use String.Format() or something like

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sascha Lefévre 350
1 Abhinav S 339
2 OriginalGriff 315
3 Sergey Alexandrovich Kryukov 245
4 deepankarbhatnagar 121
0 Sergey Alexandrovich Kryukov 9,405
1 OriginalGriff 7,802
2 Maciej Los 3,758
3 Abhinav S 3,637
4 Sascha Lefévre 3,218

Advertise | Privacy | Mobile
Web04 | 2.8.150427.4 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100