|
-
December 2nd, 2009, 08:36 PM
#1
VB 2008 Compairing 2 date and times
Hi all im struggling a bit and was wondering if anyone can help. Im looking to compair 2 sets of datess and times, for examp2 textbox1 27/02/1980 23:00 and text box 2 having the real time date and time. But instead off having years days hours mins and seconds i want to display how many seconds has passed between the two date and times. Can anyone show me how this is done as i have no clue where to start.
many thanks.
alex
-
December 3rd, 2009, 01:29 AM
#2
Re: VB 2008 Compairing 2 date and times
One option is to use the DateDiff method :
Code:
MessageBox.Show(DateDiff("s", CDate(TextBox1.Text), CDate(TextBox2.Text)))
-
December 3rd, 2009, 11:06 AM
#3
Re: VB 2008 Compairing 2 date and times
Hi i tried that and got invalidcastexeption was unhandled then on othe next line Conversion from string "" to type 'Date' is not valid. appologies for having to pester you again. Alex
-
December 3rd, 2009, 11:35 AM
#4
Re: VB 2008 Compairing 2 date and times
 Originally Posted by Zanderman1980
Hi i tried that and got invalidcastexeption was unhandled then on othe next line Conversion from string "" to type 'Date' is not valid. appologies for having to pester you again. Alex
its ok i got it now,
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|