Hi,

I am working with a proprietery language of CA & it's very much similar to C and hence I find this a good place to put my question.

I want to make some workshift calculations in a function that takes start date & end date as arguments and calculates the difference in time taking into account the shift timings. for e.g. time difference between 11/4/2004 09:00:00 & 11/5/2004 09:00:00 should be 28800 seconds (8 hours) and not 24 hours (assuming my shift timings for that day are defined as 09:00-17:00).

I have "date" data type and some in-build functions that can be used. e.g. now() returns current date in "mm/dd/yyyy hh:mm:dd" format and typecasting a date datatype to integer gives number of seconds elapsed since some reference time. e.g.

(int)now() will return 231321....(some integer value).

This is all i have for date time manipulation. I have other standard c operators like if, else, ==, etc. which i can use.

The shift times are defined in another table and right now i am only concerned with regular shif times. i.e. Mon-Fri 09:00-17:00, Sat-Sun 00:00-00:00

I will be glad if someone can help me out.

Thanks in advance.

Picaso

Hi Picaso,

It sounds like this can be broken down into the difference of two easy steps.

Compute the difference between the start and end datetimes.

Compute the shift difference.

Subtract them.

Or is this more complicated than that?

Kent