1. ## Time Difference

Hi

I have DatetIme field . I want to subtract this field from Current Time & check the difference . I fit is greater than 6 Hrs it should give message.

Thanks

3. ## Re: Time Difference

Hi

I want time difference between current time & database field

Thanks

5. ## Re: Time Difference

Originally Posted by Jagjit
Hi

I want time difference between current time & database field

Thanks
So what do you think is the solution to that is? If you want something from a database, you need get the data from the database and stuff it into a variable, yes? Soooooo......

Originally Posted by Zvoni
You didn't write the code.

-tg

6. ## Re: Time Difference

Originally Posted by techgnome
You didn't write the code.

-tg
How inconsiderate of me......

7. ## Re: Time Difference

Hi Zvoni

I want time difference in Hours

Thanks

8. ## Re: Time Difference

Again, check the DateDiff function in the help!

9. ## Re: Time Difference

Hi Arnoudtv/Zvoni

o.k but if i want that if diff in Hrs is greater than 5 it should give message & it it should display like Hours / Minutes . For ex if diff between 2 times is 2 Hrs & 30 min it should display 2 Hrs And 30 Min.

Thanks

10. ## Re: Time Difference

So use datediff to get the minutes... if it's more than 360, then it's more than 6 hours.... if it's less, it's less than 6 hours. if you then want to break it down, use the diff mod 60 to get the minutes, then use (diff - (diff mod 60)) / 60 to get the hours, format it, and display it.

-tg

11. ## Re: Time Difference

tg, that's pure math you're talking about :-)

It's funny how many people use computers, and don't have a clue about maths, considering the word Computer derives from the latin verb computare (=to calculate).

Ah well, another mystery of the universe to solve......

12. ## Re: Time Difference

The REAL mystery is why you haven't researched the DateDiff function and posted your attempts at solving your issue.

Hi techgnome

Thanks

14. ## Re: Time Difference

Originally Posted by SamOscarBrown
The REAL mystery is why you haven't researched the DateDiff function and posted your attempts at solving your issue.
Sam, the funny thing is: You don't even need the DateDiff-Function to solve this problem, considering DateTime is actually a Double-Value (The part left of the decimal representing the day, the part right of the decimal the time).
But with that we're back at maths, the universal language of the universe

Anyone here who has a working Star-Trek Universal Translator?

15. ## Re: Time Difference

Wow - I wanted to see what could possibly get up to 14 posts on a simple question of time in VB6.

I'll never get that 5 minutes back again

Seriously though - why bring attitude to a knowledge forum?

16. ## Re: Time Difference

Originally Posted by szlamany

Seriously though - why bring attitude to a knowledge forum?
Because "Knowledge" implies the willingness to learn this "knowledge", and not posting some half-baked questions, where you have to guess 50% of the meaning, and then expecting the code on a silver platter!

There is a reason the OP has a red reputation.

He made a statement (not asked a question!), we gave him an answer, that should have gotten him started. and the OP ignored this answer, instead demanding (!) "I want ......"

17. ## Re: Time Difference

Then around post #4 or #5 the OP should have been instructed to post code. Without that code being posted the thread should have died due to the ignoring it should have received.

As it stands now - this thread offers no code advice - just a link or two. Peppered in all that is repetition and sarcasm.

If you want to teach people how to ask good questions only answer those people with good questions!

18. ## Re: Time Difference

Uh, which I did at 12 when I first saw this.....(The REAL mystery is why you haven't researched the DateDiff function and posted your attempts at solving your issue.)

19. ## Re: Time Difference

Unfortunately by post #12 the thread was pretty much derailed.

Still waiting to see code - and wondering where does that "database" part come in?

Since I rely on SQL so much for my business I would have suggested changing the SELECT statement to return a message based on the time comparison - done in the query itself.

20. ## Re: Time Difference

Yeah, depending upon final use/display. BUT, OP has been so inconsistent with posts (and ever so sketchy), doubt we will find that out.

#### Posting Permissions

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