Calculate elapsed hours between two time fields
I have a form with fields TimeStart and TimeEnd. Both are formatted as field time in the format hh: mm tt. I also have a field called hours with the number format. Here is the Javascript code that I have in the section calculation Script custom field hours. Could someone tell me why it doesn't work? This script started as a date calculation script (work), and I changed to the calculation of hours instead of days.
var strStart = this.getField("TimeStart").value;
var strEnd = this.getField("TimeEnd").value;
If (strStart.length & & strEnd.length)
{
var timeStart = util.scand ("h: mm tt", strStart);
var timeEnd = util.scand ("h: mm tt", strEnd);
diff var = timeEnd.getTime () - timeStart.getTime ();
var hour = 60 * 60 * 1000;
var h = Math.floor (diff/oneHour);
Event.Value = hours;
}
of another event.value = 0;
The order for the calculation of the fields is wrong, you need to update.
Tags: Acrobat
Similar Questions
-
Calculate business hours between two dates in a cursor
Hello, its me again (?).
Yesterday, I got a solution to a problem here where I need to calculate the hours between two dates, excluding Sat/Sun and from 09:00 to 18:00. I'm now putting this login in a PL/SQL block, so I can calculate it for each record in a slider, all by looping.
The logic above, I'm up here:with t (start_date ,end_date ) as (select to_date('22-oct-2012 09:00:00','dd-mon-yyyy hh24:mi:ss') start_dt, to_date('23-oct-2012 09:00:00','dd-mon-yyyy hh24:mi:ss') end_dt from dual ) , hrs (dt) as (select start_date from t union all select dt +1/24/60 from hrs where hrs.dt < (select end_date-1/24/60 from t) ) select count(*)/60 from hrs where to_char(dt,'dy') not in ('sat','sun') and to_number(to_char(dt,'hh24')) not between 18 and 23 and to_number(to_char(dt,'hh24')) not between 0 and 8 /
I really don't like if the performance is horrible because it will run once a month and should spend only 40-100 records.FOR c_record IN c_1 LOOP //For each record, check if the two dates meet the criteria and then raise the counters accordingly select to_date(c_record.REPORTADA,'dd-mon-yyyy hh24:mi:ss') INTO vFch1 FROM DUAL; SELECT to_date(c_record.INICIOREAL,'dd-mon-yyyy hh24:mi:ss') INTO vFch2 FROM DUAL; IF ((vHoras > 2) AND c_record.PRIORIDAD=3) THEN vContOk :=vContOk + 0; vContBad := vContBad+1; vContOt := vContOt+1; ELSE vContOk :=vContOk +1; vContBad := vContBad+0; vContOt := vContOt+1; END IF; IF ((vHoras > 4) AND c_record.PRIORIDAD=2) THEN vContOk :=vContOk + 0; vContBad := vContBad+1; vContOt := vContOt+1; ELSE vContOk :=vContOk +1; vContBad := vContBad+0; vContOt := vContOt+1; END IF; IF ((vHoras > 16) AND c_record.PRIORIDAD=1) THEN vContOk :=vContOk + 0; vContBad := vContBad+1; vContOt := vContOt+1; ELSE vContOk :=vContOk +1; vContBad := vContBad+0; vContOt := vContOt+1; END IF; END LOOP;
However, I can't find a way to use this connection even in this case
Could you help me?
Thank you!
Greetings,
NACEURN wrote:
I need to calculate the number of minutes between two dates, only count the hours from 9 to 18hs.CREATE OR REPLACE FUNCTION get_bus_minutes_between( p_start_date DATE, p_end_date DATE ) RETURN NUMBER IS v_return NUMBER; BEGIN with t as ( select case level when 1 then greatest(p_start_date,trunc(p_start_date) + 9 / 24) else trunc(p_start_date) + level - 15 / 24 end start_dt, case connect_by_isleaf when 1 then least(p_end_date,trunc(p_end_date) + 18 / 24) else trunc(p_start_date) + level - 8 / 24 end end_dt from dual connect by level <= trunc(p_end_date) - trunc(p_start_date) + 1 ) select sum(greatest(end_dt - start_dt,0)) * 24 * 60 work_minutes into v_return from t where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- exclude weekends RETURN v_return; END; /
For example:
SQL> select get_bus_minutes_between( 2 to_date('20-oct-2012 13:00:00','dd-mon-yyyy hh24:mi:ss'), 3 to_date('22-oct-2012 13:21:00','dd-mon-yyyy hh24:mi:ss') 4 ) work_minutes 5 from dual 6 / WORK_MINUTES ------------ 261 SQL>
SY.
-
Calculate the hours between two dates
Hello
I have a requirement to count the hours with 2 given timestamps, something like:
However, I wish it would be that simple. I just need to count the hours between two timestamps for the hours of work for example, 08:00 - 17:00, MONDAY to Friday (excluding weekends).SQL> select ((to_date('22-oct-2012 13:00:00','dd-mon-yyyy hh24:mi:ss') - to_date('20-oct-2012 13:00:00','dd-mon-yyyy hh24:mi:ss'))*24) B from dual ; B ---------- 48
So lets say I have to count the hours between two dates above the result should be 18 hours not 48 (4 hours on 20/oct, 9 hours on 21/oct to 5 hours 22/oct).
How can I achieve this? Any idea will be useful.
Thank youMy query generates a list of all the hours between the start and end time, filters on the hours that are outside of the hours of work and then account for the remaining lines. Change that to partial hours must just be a case of replace the two occurrences of 1/24 with 24/01/60, then - as say you - Division COUNT (*) by 60.
There may be performance issues using techniques of generation of line like this, if you put this in a query involving the joining of several lines of other tables (for example where the dates of beginning and end are derived from several employees?) or in several days. If you don't find it then count the number of whole days (taking weekends into account) between dates and work on the partial days after that it could be better. This would probably involve a lot of statements of case (which I don't have time to test it now).
Ben
-
How to find the hours between two times
Hai All
I had a problem I need to calculate work time
For example
Respondent outtime
0815 1715
So I need to calculate a time between these two times
How can I do using function for 100 our
Concerning
Srikkanth.MHello
use the below the update statement.
update dail_att set wtime = extract(hour from (to_date(outtime,'HH24:MI')-to_date(intime,'HH24MI')) day to second);
Solution of the sample...
PRAZY@11gR1> desc dte; Name Null? Type ------------------- -------- -------- INTIME VARCHAR2(4) OUTTIME VARCHAR2(4) HRS NUMBER PRAZY@11gR1> select * from dte; INTIME OUTTIME HRS ---------- ---------- ---------- 0815 1715 0900 1800 0830 1630 Elapsed: 00:00:00.00 PRAZY@11gR1> update dte set hrs = extract(hour from(to_date(outtime,'HH24MI')-to_date(intime,'HH24MI')) day to second); 3 rows updated. Elapsed: 00:00:00.01 PRAZY@11gR1> select * from dte; INTIME OUTTIME HRS ---------- ---------- ---------- 0815 1715 9 0900 1800 9 0830 1630 8 Elapsed: 00:00:00.00
Kind regards
PrazyPublished by: Prazy on March 24, 2010 12:43
-
How to calculate the hours between two dates by the numbers
If I update 09:00 start time 17:00 end time of shift in C3 and B3, how to use a D3 formula to calculate the number of hours between the two? Then I can just copy down the lines for nth years...
It is a spreadsheet of the part-time staff payroll.
I'm sure that a lot of people out there have done that.
Help, please.
Thank you.
Eddie
What program of worksheet that you are using? Since you have a newer iMac running El Capitan, I can safely assume that you use NOT AppleWorks, which is a Power PC application that can run on any OS newer than the snow leopard, OS X 10.6.8.
If you use numbers, try to repost your question in numbers for Mac forum. If you use Microsoft Excel, try posting in the Microsoft forums. LibreOffice also has community support.
-
difference in hours between two time zones of differnet
I have a sysdate (EAST) and a function util_pkg.local_tz returns a different datetime value.
I need to get the difference in hours between sysdate and another date.
Select sysdate, util_pkg.local_tz (sysdate, ' Asia/Seoul') of double;
18/05/2011 11:15:00.000000000 FROM 18/05/2011 10:15 PM + 09:00
Quest:-find the difference in hours between these two date and then add the difference of hours + sysdate
FUNCTION local_tz (p_datetime IN TIMESTAMP, p_timezone IN VARCHAR2) RETURN TIMESTAMP WITH TIME ZONE AS BEGIN RETURN FROM_TZ(p_datetime, TZ_OFFSET(con_database_timezone)) AT TIME ZONE TZ_OFFSET(p_timezone); END local_tz;
When you calculate the diff between TIMESTAMP WITH TZ they both are converted to time UTC (in fact they are stored as UTC). So diff between SYSTIMESTAMP in EST and SYSTIMESTAMP in Seoul will always be 0, as bioth are "now". You need to cast TIMESTAMP WITH TZ 'losing' time zone timestamp:
SQL> select cast(systimestamp at time zone 'Asia/Seoul' as timestamp) - systimestamp from dual; CAST(SYSTIMESTAMPATTIMEZONE'ASIA/SEOUL'ASTIMESTAMP)-SYSTIMESTAMP --------------------------------------------------------------------------- +000000000 13:00:00.000000 SQL>
SY.
-
Calculations between two time fields
Hello
I have a form with a time for the start time field and a text field for the user to enter a duration (for example, 00:30:00).
There is another field for the end of time (which has a calculation script using the date and starting time fields).
The script that was placed in the end time field works except the script gives a negative result.
For example the start time field is 16:03:33 and 00:30:00 duration field calculation end is showing time field-
Please can someone advise how I can change the script of the time field end to show the correct result of 16:33 (without the negative)?
create string for the current date
var oToday = new Date();
sToday var = util.printd ("yyyy/mm/dd", oToday);get the value of the start time field
var sStart = this.getField("Action_Start_Time").value;
create the JavaScript date object time for start time
var start = util.scand ("yyyy/mm/dd hh: mm:", sToday + sStart);
get the duration valueSend var = this.getField("Action_Time").value;
create a JavaScript date object time to end time
oEnd var = util.scand ("yyyy/mm/dd hh: mm", sToday + shipment);calculate the difference in hours, the difference in hours
var DiffHours = (oEnd.valueOf () - oStart.valueOf (()) / 1000 / 60 / 60;
Event.Value = Math.floor (DiffHours) + ': ' + util.printf ("%,302.0f", (((DiffHours % 1) * 60) .toFixed (()));Any help will be greatly appreciated.
You cannot change the '-' operator operator '+' being Modulo calculation date and time calculations. You must calculate the different parts of the date and time of the start time and elapsed time and then convert these values into a date object time and format of this new date time object.
Clear the field
Event.Value = "";
getting the activity start time
var sEventStart = this.getField("Activity_Start_Time").value;
calculate only if there is a start time
If (sEventStart! = "") {}
operations of the console are for debugging and illustration
/*
Console.Show ();
Console.clear();
*/
convert a date object change if necessary format
var oEventStart = util.scand ("YYYY, mm, DD, HH", nNowYear + "," + (nNowMonth + 1) + ',' + nNowDate + ', ' + sEventStart);
Console.println ("oEventStart:" + oEventStart);get the date current time
var oNow = new Date();
Console.println ("oNow:" + oNow);
get the date parts
var nNowYear = oNow.getFullYear ();
var nNowMonth = oNow.getMonth ();
var nNowDate = oNow.getDate ();
/*
Console.println ("nNowYear:" + nNowYear);
Console.println ("nNowMonth:" + nNowMonth);
Console.println ("nNowDate:" + nNowDate);
*/
get the duration of activity
var sEventDuration = this.getField('Event_Duration').value;
If no entry in force at time zero
if(sEventDuration == '') sEventDuration = "00:00:00 ';
convert the time in hours and minutes
var aEventDuration = sEventDuration.split(":");
/*
Console.println (' hours - aEventDuration [0]: "+ aEventDuration [0]");
Console.println ('Minutes - aEventDuration [1]: "+ aEventDuration [1]");
Console.println (' hours start: "+ oEventStart.getHours ());
Console.println ("minutes:" + oEventStart.getMinutes ());
Console.println ("second Start:" + oEventStart.getSeconds ());
*/
calculate the minutes and the end times
var nEndHour = Number (oEventStart.getHours ()) + Number(aEventDuration[0]);
var nEndMinute = Number (oEventStart.getMinutes ()) + Number(aEventDuration[1]);
if(aEventDuration.Length == 3)
var nEndSecond = Number (oEventStart.getSeconds ()) + Number(aEventDuration[2]);
on the other
var nEndSecond = Number (oEventStart.getSeconds () + 0;
/*
Console.println ("nEndHour:" + nEndHour);
Console.println ("nEndMinute:" + nEndMinute);
Console.println ("nEndSecond:" + nEndSecond);
Console.println ("nNowYear:" + nNowYear);
Console.println ("nNowMonth:" + nNowMonth);
Console.println ("nNowDate:" + nNowDate);
*/
do the date for the end of the event object - calculate the hours and minutes
oEnd var = new Date (nNowYear, nNowMonth, nNowDate, nEndHour, nEndMinute, nEndSecond);
Console.println ('oEnd: ' + oEnd);
change the format if necessary
Event.Value = util.printd ("HH", oEnd);
} / / end of event time -
HelloI have a laptop (TotalTime1) which refers to two other cells in the updated hour-shaped (Start1 and 1 to finish).
The formula below is intended to make the difference between the time of departure and of arrival if they are populated.
I had to work unconditionally HasValue, but the formula was calculated when there is no value in the Start1 and Finish1 (due to the time format).
This is the code I have, it is said that there is an error of almost the last line; I'm sorry if I'm posting this in the wrong way, I haven't posted on this forum before but this is:
If (HasValue (Finish1) and HasValue (Start1)) then if (Time2Num (Start1.formattedValue, "HH: mm") < Time2Num (Finish1.formattedValue, "Hh: mm")) then Abs (Time2Num (Start1.formattedValue, "HH: mm")-Time2Num (Finish1.formattedValue, "HH: mm")) / (60 * 60 * 1000) another 24 - ABS (Time2Num (Finish1.formattedValue, "HH: mm")-Time2Num (Start1.formattedValue, "HH: mm")) / (60 * 60 * 1000) endif
Any help would be appreciated.
Cordially Fetachini
you need an another endif at the end (you have nested statement and only 1 endif)
-
How to calculate the difference between two times by the NUMBERS
I'm so bothered by the fact that I can't understand that.
Cell B2 - 08:00
Cell C2 - 10:50
(How can cell D2 - I get this cell to calculate the difference and say 02:50?)
I know it's probably one of the most basic operations, but for the life of me I can't understand it. The cells B2 and C2 are formatted for a 24-hour clock. But if I tell the system to just subtract the two, I get "0,118. Everything I find on the forum search goes beyond what I need. Can someone help me?
Thank you
Hi sapirs,
Departure and arrival of the cells are in Date and time with Date format: no and time: 24-hour clock.
Formula in D2 (fill down)
= C2−B2
The results become a duration format, but under automatic (numbers automatically worth this format)
If you wish, you can change the cells of lasting results.
What Data Format have your result cells?
Kind regards
Ian.
-
Calculate business hours between 2 dates with negative numbers
Hi all
I use a function to calculate the difference between 2 dates schedules. The function was taken and adapted from this thread:
Calculate business hours between two dates in a cursor
CREATE OR REPLACE
FUNCTION get_bus_minutes_between(
p_start_date DATE,
p_end_date DATE
)
RETURN NUMBER
IS
v_return NUMBER;
BEGIN
with t as (
select case level
when 1 then greatest(p_start_date,trunc(p_start_date) + 9 / 24)
else trunc(p_start_date) + level - 15 / 24
end start_dt,
case connect_by_isleaf
when 1 then least(p_end_date,trunc(p_end_date) + 20 / 24)
else trunc(p_start_date) + level - 4 / 24
end end_dt
from dual
connect by level <= trunc(p_end_date) - trunc(p_start_date) + 1
)
select sum(greatest(end_dt - start_dt,0)) * 24 * 60 work_minutes
into v_return
from t
where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- exclude weekends
RETURN v_return;
END;
/I am running into an issue that when the p_end_date is before the p_start_date value the function returns the full time between the dates without regard for business hours. if the end_date is before the start date I get the expected result i.e. difference between the dates in business hours.
Using example dates of start 19th October 2012 13:00:00 and end 22nd october 2012 13:21:00 the business minutes are 681. However if i reverse the dates I get -4341.
Correct labour code is the following, I've annotated so that he could help someone else looking for a solution like this:
CREATE OR REPLACE
FUNCTION get_bus_minutes_between(
p_start_date DATE, --these are the 2 dates passed into the function
p_end_date DATE--these are the 2 dates passed into the function
)
RETURN NUMBER
IS
v_return NUMBER;l_start DATE;
l_end DATE;
l_factor NUMBER;
BEGINIF p_start_date <= p_end_date THEN --this IF section checks which of the 2 dates is the greatest
l_start := p_start_date; -- and then assigns the earliest date to p_start_date
l_end := p_end_date;
l_factor := 1;
ELSE -- swap the dates around, and multiply the result by -1
l_start := p_end_date;
l_end := p_start_date;
l_factor := -1;
END IF;
with t as (
select case level
when 1 then greatest(l_start,trunc(l_start) + 9 / 24) -- this sets the start of working hours
else trunc(l_start) + level - 15 / 24 --if the start time is adjusted this value must also be adjusted
end start_dt,
case connect_by_isleaf
when 1 then least(l_end,trunc(l_end) + 20 / 24) -- this sets the end of working hours
else trunc(l_start) + level - 4 / 24 -- if the end time is adjusted this value must also be adjusted
end end_dt
from dual
connect by level <= trunc(l_end) - trunc(l_start) + 1
)
select sum(end_dt - start_dt) * 24 * 60 work_minutes -- this subtracts the 2 dates and then multiplies by hours and minutes
into v_return
from t
where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- this exclude weekends
RETURN v_return * l_factor; -- this gives the negative or positive results so you can see if it was completed before or after the required date.
END;
/ -
I am building a working method in LiveCycle, and I want to track how long the procedure takes. To do this, I have two time fields, and then a third time field to find the difference between two time fields. Looking at other posts to discussion, I could find a Javascript code that was part of what I wanted, but I can't get the third time field to display in the format I want. I tried to change the habits of the fields and that did not work. Could someone offer some advice on how to change the format or help me with the code? I couldn't figure to attach the actual file, but I have attached a picture of the PDF file and the Javascript code I used. If you look at the TimeIn (hh: mm) and time (hh: mm) areas (on the photo, I have attached), you will notice that the TotalTime comes out like HMM, and I want that it out as hh: mm.
Any help would be greatly appreciated!
Thank you
this.rawValue = (totalHrs > 9? String (totalHrs): '0' + String (totalHrs)) + ':' + (totalMins > 9? String (totalMins): '0' + String (totalMins));
-
Help! Calculate a percentage between two fields that the sum of columns
Members of the forum good day!
I'm hoping to get help with and model RTF I use to sum up the output of a query in PeopleSoft.
I have a line with two fields of the query and a third field calculates a percentage using the query fields:
Row1, Field1: EXPR14_14
Row1, Field2: EXPR1_1
Row1, Field3: <? xdofx: If EXPR1_1 <>0 and EXPR14_14 0 then (EXPR1_1 DIV EXPR14_14) <>* 100 or 0 end if? >
I have a second row who has these fields:
Row2, Field1: <? sum (EXPR14_14)? >
Row2, Field2: <? sum (EXPR1_1)? >
Row3, Field3: I need the third field to calculate the percentage of sum of two fields.
I tried different ways to insert this calculation with no luck. It's my first time to create a rtf report and any help would be gratly appreciated.
In advanced thank you for your help.
Kind regards
RaquelFor the calculation of percentage you can use something similar to this (adjust the formula you need)
(sum(current-group() xpr1_1))="" div="" (sum(current-group()/expr14_14)="" )*="" 100?=""?>
For Row1, Field3:(EXPR1_1 div="" expr14_14)*100?=""?>
Hope that helps. If you need more help, send me the xml file and the [email protected] model
Thank you
Bipuser -
Count the hours between the times of the day
Hello
It is a timesheet, calculation of payment:
I'm trying to find a way to calculate how many hours is between two specific times of the day.
I enter a start time and an end time (in 2 different items), I calculate the number of hours that is. What I can understand.
Then I need to know how many hours is between 16:00 and 22:00.
The reason is that there is an additional extra payment for those hours.
So: "payment on time' X ' total hours work in a day ' + 'bonus' X ' hours between 16 and 22" = "total wages for a day" "»
Thank you
Enter the full date and time in columns A and B (for example ' 12 Sep 2016 8:00 AM "or you like the what ever valid date time value):
C2 = B2−A2
D2 = C2−DURATION (0, 0, 24 × MAX (TIMEVALUE "(04:00 PM)") −TIMEVALUE (A2), 0)) −DURATION (0, 0, 24 × MAX (TIMEVALUE (B2) −TIMEVALUE (' 22:00 "" "), 0))
Select cells C2 and D2, copy
Select cells C2 at the end of column D, dough
If you prefer the values in column D as decimal hours use the formula:
dur2hours (D2)
or replace the formula earlier as follows:
D2 = dur2hours (C2−DURATION (0, 0, 24 × MAX (TEMPSVAL ("04:00 PM") −TIMEVALUE (A2), 0)) −DURATION (0, 0, 24 × MAX (TIMEVALUE (B2) −TIMEVALUE (' 22:00 "" "), 0)))
-
calculation of time between two time as timestamp
How can calculate two hour, START as the timestamp TIME in the data type, END TIME as of time also.
select END_TIME-START_TIME from PROG_DLY_WORK
Result
+ 01:50:00.000000 000000000
How can get exactly the time spent as 01:50 ? and these calculated time must sum (elapsed_time) in another column.
oracle as PaaS cloud environment
Product VERSION STATUS NLSRTL 11.2.0.3.0 Production Oracle Database 11g Enterprise Edition 11.2.0.3.0 64 bit Production PL/SQL 11.2.0.3.0 Production AMT for Linux: 11.2.0.3.0 Production Time difference between two columns in hours
Start
FOR REC IN (SELECT START_TIME, END_TIME, CALC_TIME CAL_ID)
LOOP
UPDATE CALc_TIME
SET ELAPSED_TIME = round (())
TO_DATE (to_char (REC. End_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")-
TO_DATE (to_char (REC. Start_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")
() * 24).
WHERE CAL_ID = REC. CAL_ID;
END LOOP;
end;
Lag in minutes
Start
FOR REC IN (SELECT START_TIME, END_TIME, CALC_TIME CAL_ID)
LOOP
UPDATE CALc_TIME
SET ELAPSED_TIME = round (())
TO_DATE (to_char (REC. End_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")-
TO_DATE (to_char (REC. Start_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")
() * 24 * 60)
WHERE CAL_ID = REC. CAL_ID;
END LOOP;
end;
-
Calculate the hours between 2 business days
Hi all
Do a complex calculation on the days I do not know how to achieve this.
Here is my case:
I have a week of work with hours of work.
Then there's this delivery time sheet for how long should be set an order ready to be delivered:
Order1: max 5 hours of work
Order2: max 8 working hours
Order3: max 16 hours of work
When an order is placed, the time of the order is recorded, and when an order has been set in ready to be delivered, this time is also registered.
How to calculate the time difference between the time where an order has been placed and the time where the order has been on loan. Thereby also taking into account the working days and hours of work.
Example: type order1 order was placed Tuesday at 15:00.
Order has been fixed loan Wednesday at 14:00
This means that to fix this ready order lasts 7 hours, which means that it is 2 hours time.
CREATE TABLE REF_WORKDAYS ( "WERKDAG" VARCHAR2(15 ) NOT NULL ENABLE, "SOORT_WERKDAG" VARCHAR2(15 ) NOT NULL ENABLE, "BEGIN_TIJD" VARCHAR2(10 ) NOT NULL ENABLE, "EIND_TIJD" VARCHAR2(10 B) NOT NULL ENABLE, )
Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Monday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Tuesday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Wednesday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Thursday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Friday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Satrurday','WORKINGDAY','08:00','14:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Sunday','NOT-WORKINGDAY','08:00','16:00'); COMMIT;
create table glas_order (order_id number , order_desc varchar2(100) not null , order_type varchar2(10) not null , order_date date not null , order_ready date );
Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (1,'order bla','Order1',to_date('07-APR-15 09:00','DD-MON-RR HH24:MI'),to_date('08-APR-15 12:00','DD-MON-RR HH24:MI')); Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (2,'order nice','Order1',to_date('14-APR-15 10:00','DD-MON-RR HH24:MI'),to_date('16-APR-15 16:00','DD-MON-RR HH24:MI')); Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (3,'order ugly','Order2',to_date('18-APR-15 13:00','DD-MON-RR HH24:MI'),to_date('21-APR-15 09:00','DD-MON-RR HH24:MI')); COMMIT;
Thank you
Diana
Select
I like order_id
such as length d
order_type
d decode(order_type,'Order1',5,'Order2',8)
overtime
of glas_order o
model
Reference r on
(select
WERKDAG w
begin_tijd b
e eind_tijd
, (to_date (eind_tijd, 'HH24') - to_date (begin_tijd, 'HH24')) * 24 hard
of ref_workdays
where soort_werkdag = "WORKINGDAY")
dimension (w)
measures (b, e, hard)
main m
partition of (order_id I)
size of (0 n)
measures (0d, order_date, order_ready, cast (null as varchar2 (10)) as wday, order_type)
iterate (1e6) rules until (iteration_number > = trunc(order_ready[0]) - trunc(order_date[0])))
WDAY [0] = to_char (order_date [0] + iteration_number, 'FMDay', 'NLS_DATE_LANGUAGE = ENGLISH')
, d [0] = d [0] +.
case
When trunc(order_date[0]) = trunc(order_ready[0]) - beginning and ready same day
then presentv (r.b [wday [0]],)
less (largest (order_ready [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')), to_date (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))
-bigger (to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI'), least (order_date [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))))
0) * 24
When order_date [0] + iteration_number = order_date [0] - first day
then presentv (r.b [wday [0]],)
TO_DATE (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]], 'YYYYMMDDHH24:MI')
-bigger (order_date [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]],'YYYYMMDDHH24:mi'))))
0) * 24
When trunc(order_date[0]) + iteration_number = trunc(order_ready[0]) - last day
then presentv (r.b [wday [0]],)
less (order_ready [0], to_date (to_char (order_ready [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))
-to_date (to_char (order_ready [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')
0) * 24
of another nvl (r.dur [wday [0]], 0)
end
)
ORDER_ID DURATION ORDER_TYPE OVERTIME 1 11 Order1 6 2 22 Order1 17 3 10 Order2 2 Rewrittten party rules for readability purposes (more resources)
measures (0d, order_date, order_ready, cast (null as varchar2 (10)) as to_date (null), (null) to_date, bd, order_type, wday ed)
iterate (1e6) rules until (iteration_number > = trunc(order_ready[0]) - trunc(order_date[0])))
WDAY [0] = to_char (order_date [0] + iteration_number, 'FMDay', 'NLS_DATE_LANGUAGE = ENGLISH')
, comics [0] = to_date (to_char (order_date [0] + iteration_number, 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')
, ed [0] = to_date (to_char (order_date [0] + iteration_number, 'YYYYMMDD') | r.e [WDAY [0]], 'YYYYMMDDHH24:MI')
, d [0] = d [0] +.
case
When trunc(order_date[0]) = trunc(order_ready[0]) - beginning and ready same day
then presentv (r.b [wday [0]],)
less (largest (order_ready [0], [0] bd), ed [0])
-Greatest (BD [0], least(ORDER_DATE[0],ED[0]))
0) * 24
When order_date [0] + iteration_number = order_date [0] - first day
then presentv (r.b [wday [0]],)
ED [0]
-Greatest(ORDER_DATE[0],BD[0])
0) * 24
When trunc(order_date[0]) + iteration_number = trunc(order_ready[0]) - last day
then presentv (r.b [wday [0]],)
least(order_ready[0],ED[0])
-bd [0]
0) * 24
of another nvl (r.dur [wday [0]], 0)
end
)
Jubilee should be Saturday I guessed.
Maybe you are looking for
-
button to archive does not work. Win 10
Button win 10 - archive does not work in Thunderbird emails with current updates
-
I want icon to stay there until I have openedd messages.
When reinstalled Thunderbird hard drive replaced. Now the tray re icon new messages only very briefly, there rather than to what messages have been opened - which is what I'm used to I want to come back. Why this feature has disappeared? I had it bef
-
MY DVD DRIVE DISAPPEARED FROM 'DISCOVER' HOW DO I GET IT BACK
It worked very well for some time and then I inserted a dvd then everything about the dvd in Explorer just disappeared and the disc was stuck inside. It's just like if the power has been removed by the player - for example no lights
-
I have amtrying to load the HP Photosmart D71000 series. Keep is error message: the software can be installed by using the command "run under...". ». Advice suggests logon as a user with administrator privileges. This was done and same message came.
-
Problem with DateTimePicker does not extend correctly
Hello I am currently tinkering around with some of these shape objects and I put a DateTimePicker control in my code QML. It shows very well with the current selected date, but when I click on the selector to change the date, it only shows the top l