Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTimePicker Question - pls help

Status
Not open for further replies.

Lxmm

Programmer
May 10, 2005
32
GB
Hi,
In my VB.net form, I have 4 DateTimePicker controls.
2 of these used to capture dates and other 2 to capture times.

i.e.
Start Date
Start Time
End Date
End Time

1. How can I set this control to capture times? I have changed the format property to 'time', but at run time, it shows as dates.

2. How can I calculate difference between days (i.e.. EndDate-StartDate) and differences between Hours (EndTime-StartTime)?

Any help will greatly appreciated.
 
1. Do you mean that the drop-down still shows dates? If so, you need to set the control's ShowUpDown property to True. This will, surprisingly, show and up-down control on the DTPicker which will allow you to change the hours, minutes, seconds and AM/PM in the time.

2. Do a search in this forum for DateDiff - the function you need to do this.




I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top