Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

Date & time separate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Agnes - 29 Oct 2004 16:06 GMT
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.
cbDevelopment - 30 Oct 2004 03:51 GMT
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.

> 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.
Jay B. Harlow [MVP - Outlook] - 30 Oct 2004 17:21 GMT
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

> How about:
>
[quoted text clipped - 10 lines]
>> time ??? Can I put it into two separate textbox , but save in one
>> datafield ? thanks a lot.
cbDevelopment - 31 Oct 2004 16:05 GMT
Excellent observation.

Thanks.

> cbDevelopment,
> I would recommend:
[quoted text clipped - 26 lines]
>>> time ??? Can I put it into two separate textbox , but save in one
>>> datafield ? thanks a lot.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.