Click here to Skip to main content
12,818,315 members (35,579 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB .NET 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
Updated 25-Feb-13 7:06am
richcb 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2017
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