473,413 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 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 2953
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);
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.