470,647 Members | 1,085 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

time arithmetic

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
2 2895
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
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.

Similar topics

96 posts views Thread by John Harrison | last post: by
5 posts views Thread by Alan Webb | last post: by
18 posts views Thread by Tim Quon | last post: by
14 posts views Thread by George | last post: by
26 posts views Thread by Pravesh | last post: by
21 posts views Thread by SSG | last post: by
5 posts views Thread by kpp9c | last post: by
7 posts views Thread by barikat | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.