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
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
Jump to Postyou need to format the value of DTPicker.
Jump to PostMust 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 …
you need to format the value of DTPicker.
try and use something like -
Text1.Text = dtPicker1,Value
Text1.Text = Format(Text1.Text, "dd,mm,yy")
Hope this helps...
some little change
Text1.Text = dtPicker1.ValueText1.Text = Format(Text1.Text, "dd,mm,yy")
Text1.Text = dtPicker1.Value
Text1.Text = Format(Text1.Text, "dd,mm,yy")
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.