Click here to Skip to main content
Rate this: bad
good
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 5:39am
Edited 25-Feb-13 6:06am
v2
Comments
richcb at 25-Feb-13 11:40am
   
That is not a question. Please elaborate and be specific when asking your question.
Rate this: bad
good
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")
  Permalink  
v2
Comments
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
good
Please Sign up or sign in to vote.

Solution 2

Use String.Format() or something like
Me.DateTimePicker1.Value.ToString("dd/MM/yyyy")
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 _Amy 235
2 Andreas Gieriet 180
3 Peter Leow 175
4 Dave Kreskowiak 155
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,597
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
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