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
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)))
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
Re: VB 2008 Compairing 2 date and times
Quote:
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, :)