Hello,
I have a DatePicker and text box on my Form and When I try to show the choosen date of DatePicker in the TextBox. It Shows the date and time. But I want to show only date. Plz help me.

Code:
text1.text=DatePicker1.value

try and use something like -

Text1.Text = dtPicker1,Value
Text1.Text = Format(Text1.Text, "dd,mm,yy")

Hope this helps...

Text1.Text = dtPicker1.Value
Text1.Text = Format(Text1.Text, "dd,mm,yy")

Edited 7 Years Ago by abu taher: n/a

Must have been the wine.... comma in place of point. LOL

Some more dtPicker help for you all -

Private Sub DTPicker1_Click()
Text1.Text = DTPicker1.Value 'To get the date
Text2.Text = DTPicker1.Day 'To get the Day
Text3.Text = DTPicker1.Month 'To get the Month
Text4.Text = DTPicker1.Year ' To get the Year
Text5.Text = DTPicker1.DayOfWeek ' To get the Day of the Week
Text6.Text = Format(DTPicker1.Value, "DD-MM-YYYY", vbSunday,
vbFirstFullWeek) 'To set the date format as required
Text7.Text = DateAdd("d", 10, "01/02/2001") ' To add 10 days to the given date
Text8.Text = DateAdd("m", 10, "01/02/2001") 'To add 10 months to the given date
Text9.Text = DateAdd("yyyy", 10, "01/02/2001") 'To add 10 years to the given date
Text10.Text = DateDiff("d", "01/05/2001", "01/30/2001") 'To find the
number of days between any two dates
End Sub

Hope this clears some questions.

This article has been dead for over six months. Start a new discussion instead.