Date & time separate

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I know how to display Date only in the textbox . but How about the time ???
Can I put it into two separate textbox , but save in one datafield ?
thanks a lot.
 
How about:

dAnydate=now
txtDate.text=danyDate.ToShortDateString
txtTime.text=dAnydate.toShortTimeString

dNewDate=date.parse(txtDate.text & " " & txtTime.text)

Be sure to wrap your date.parse line in a try block since you're dealing
with potentially bad user input.
 
cbDevelopment,
I would recommend:
txtDate.text=danyDate.ToShortDateString
txtTime.text=dAnydate.toShortTimeString

Dim theDate As DateTime = CDate(txtDate.text) ' or DateTime.Parse
Dim theTime As DateTime = CDate(txtTime.text) ' or DateTime.Parse

dAnydate = theDate + theTime

Simply to guard against globalization problems.

Hope this helps
Jay
 
Excellent observation.

Thanks.

cbDevelopment,
I would recommend:


Dim theDate As DateTime = CDate(txtDate.text) ' or DateTime.Parse
Dim theTime As DateTime = CDate(txtTime.text) ' or DateTime.Parse

dAnydate = theDate + theTime

Simply to guard against globalization problems.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top