# Thread: Count seconds between two dates (VB6)

1. ## Count seconds between two dates (VB6)

Probably really simple but I can't get it to work:

I want to calculate the number of seconds between two given dates say 23:59hrs 31/8/05 and Now(). I can't seem to format the time in the future, any help please?

2. ## Re: Count seconds between two dates (VB6)

Say that A1 contains 31/08/2005 23:59 and that A2 contains the formula =NOW().
Since Excel stores dates/times with 1 day as unit, the difference between A1 and B1 is a number of days. To convert to seconds, multiply by 86400 (the number of seconds in one day, 24*60*60).
So you can use the formula =(A1-B1)*86400

3. ## Re: Count seconds between two dates (VB6)

Hi Hans

I can do the Excel version but I am looking to do this in VB6. I am unsure how to format the future date.

Now gives me 12/8/05 10:46:13 (say) how do I format the future date?

4. ## Re: Count seconds between two dates (VB6)

Sorry, I didn't notice VB6 in the subject. <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>

I'm not sure what you're asking. Do you want to calculate the number of seconds between two dates/times, or do you want to calculate the date/time a specified number of seconds from now?

5. ## Re: Count seconds between two dates (VB6)

Basically a count down... the number of seconds to go before 31/8/05 23:59.(say)

6. ## Re: Count seconds between two dates (VB6)

I'm sure I'm being stupid, but I don't see where formatting a future date comes in if you want to do a countdown. I have attached a very basic <img src=/S/pun.gif border=0 alt=pun width=22 height=18> project.

7. ## Re: Count seconds between two dates (VB6)

Thanks Hans

CDate was the answer, everything else was there [growl]

<img src=/S/note.gif border=0 alt=note width=20 height=20> Must get help files installed on my PC <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•