472,805 Members | 755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

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 2940
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

96
by: John Harrison | last post by:
I knew that unsigned integral data types were the cause of scads of mostly spurious warning messages, but I didn't realise that they were a security risk too (see here...
5
by: Alan Webb | last post by:
Guys, I get this: Regular Hours are any hours less than the number of hours that can be worked before the hours begin to be counted as overtime in the period. Overtime Hours are any hours...
18
by: Tim Quon | last post by:
Hi I need to print the current time. I found an example where this is done as followed: long *mytime; time(mytime); printf("time: %s", ascitime(mytime); But this doesn't work and prints...
14
by: George | last post by:
In Time.h there is a structure defined for time settings. I'm building an embedded system that has a Real Time Clock but it's not PC compatible. My question is: I don't some elements of the...
26
by: Pravesh | last post by:
Hi: is there a way to get current system time in milliseconds... which functions and headers?? thanks pravesh
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
21
by: SSG | last post by:
Hi All! I want to know how to display the system time without using--system("date"). can anyone give me the idea to handle this operation. By S.S.G
4
by: PDHB | last post by:
I'm sorry, but this is just the height of stupidity. I love the dot net framework. It has actually been sufficient to convert an anti-microsoft extremist (myself) to the windows camp. But not...
5
by: kpp9c | last post by:
Hi, I was looking at python & datetime and hoping that it would already have a method/func to translate time formats. I need to translate seconds to hh:mm:ss.ms and vice versa and would like...
7
by: barikat | last post by:
int a; int *Ptr1, *Ptr2; Ptr1 = a; Ptr1++; Ptr2 = a; printf("Ptr1 : %p\n", Ptr1); printf("Ptr2 : %p\n\n", Ptr2);
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.