By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,301 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,301 IT Pros & Developers. It's quick & easy.

time arithmetic

P: n/a
I want to calculate the duration of time for a timecard project. This
is a sample:

totaltime = (endtime1 - starttime1) + (endtime2 - starttime2)

totaltime is numeric, starttime1 & 2, endtime1 & 2 are ISO time values.
I am stumped so far, can anyone lend an example of the syntax?
thanks,
tony
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
This seems OK. I mean the right part of the expression.
You'll probably need to convert when from strings or make up the each date,
the example of what you mean by ISO date, would help, but postgres should be
able to deal with it.
What number do you want in the left part?
the number of days, seconds, years?

"Tony Pack" <to***@psbiz.org> wrote in message
news:9J********************@comcast.com...
I want to calculate the duration of time for a timecard project. This is a
sample:

totaltime = (endtime1 - starttime1) + (endtime2 - starttime2)

totaltime is numeric, starttime1 & 2, endtime1 & 2 are ISO time values. I
am stumped so far, can anyone lend an example of the syntax?
thanks,
tony


Jul 19 '05 #2

P: n/a
Hi Tony,

I'm guessing that you're trying to do these calculations in an SQL query?
How about this:

SELECT ( (time '10:00' - time '08:00') + (time '17:00' - time '15:00') )
AS TotalTime;

Hope this helps.

Cheers,
w.k.

On Sun, 6 Mar 2005, Tony Pack wrote:
I want to calculate the duration of time for a timecard project. This
is a sample:

totaltime = (endtime1 - starttime1) + (endtime2 - starttime2)

totaltime is numeric, starttime1 & 2, endtime1 & 2 are ISO time values.
I am stumped so far, can anyone lend an example of the syntax?
thanks,
tony

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.