Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating with TIME problem 1

Status
Not open for further replies.

Genotix

Programmer
Dec 16, 2004
53
0
0
NL
Hi All,

I've got a relatively small problem to which I can't seem to find an answer.

In a production process employees can enter a time which they spent on a production.
The start time is entered in the system and stored in the database in a date format.
I would like to calculate the estimated time of finishing when the production time is entered.

Effectively I'd like to create a sum like e.g. :
'15-11-2004 11:00:00' + '02:00:00'
The answer would be then : '15-11-2004 13:00:00'

The factory is one that's opened 24/7, so this should also be possible :
'15-11-2004 23:00:00' + '02:00:00'
The answer would be then : '16-11-2004 01:00:00'

Thanx in advance for your replies!

Linux IS userfriendly.
It's only very selective about who it's friends are.
 
Exactly what I needed!!

Thanx a million!!

Linux IS userfriendly.
It's only very selective about who it's friends are.
 
Hi,

Could have provided a slightly fuller answer there.

Here goes. For your example you would use something like this:
Code:
DateAdd("H",2,"15-11-2004 23:00:00")
That would add hours ("H"), two of them (,2,) to the date specified at the end, the one you would retrieve from your DB.

Hope this helps


Harleyquinn

---------------------------------
For tsunami relief donations
 
Sorry for the explanation after the answer was accepted but I must have been typing at the same time as Genotix. Oh well, it doesn't matter.

Genotix - Cheers for the star, glad I could help.

Harleyquinn

---------------------------------
For tsunami relief donations
 
I've seen the syntax and understood it immediately.

Thanx anyway for the explanation :D

Linux IS userfriendly.
It's only very selective about who it's friends are.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top