In the time field calculation

Need to calculate the values of A and B

Formula->

A = turn down [A_TIME - A_STD]

B = Round-up [A_TIME) - 10 minutes + A_STD]


where

A_TIME VARCHAR2 (8) N hour (Format"" hh: mm AM/PM ") for example"15:50.
A_STD VARCHAR2 (5) N Standard time (Format"" hh: mm ") for example"01:00 ".


Allowed values for A and B after round up/down = multiple of 10 (11:00, 11:10, 11:20 etc.)

Hello

user3709609 wrote:
... can you please explain the below line of code

To_char (TRUNC (SYSDATE) + ((RONDE (t_minutes + s_minutes-5.01,-1)) / 24 / 60), "Hh: mi AM")

for the Round up [A_TIME - 10 minutes + A_STD]

I find it easier to understand phrases like that when I read them from the inside.
t_minutes is a whole number of minutes after midnight, for example 230 (i.e. 03:50).
t_minutes + s_minutes is the last time not rounded, also an integer
t_minutes + s_minutes - 5.01 is 5 minutes and a small part of it, before. Why we are subtracting 5.01 rather than 10 will become clearer in the next step.
ROUND (t_minutes + s_minutes - 5.01, - 1) is the previous sum rounded to the nearest multiple of 10 (for example 21 would be rounded up to 20). We want to round up to the higher multiple of 10 (21 would be rounded up to 30), which is almost the same as the addition of 5 and then rounded up to the nearest multiple, except if the original number is already a multiple of 10. For example, if t_minutes is 230 and s_minutes 60, so we want to 230 + 60 - 10 = 280, but TOWER (230 + 60 - 5-1) (i.e., ROUND (285, -1) is 290, because ROUND always rounds away from 0 when multiple "nearest" is ambiguous.) This is why we need this tiny part; So instead of tounding 285 to the nearest 10, we are rounded 284.99, and the 10 closest is unambiguous: 280. This fraction fraction significance only when the value of the integer ends with 5.
ROUND (t_minutes + s_minutes - 5.01, - 1) / 24 / 60 is the number of minutes, converted to a number of hours, as ago 24 hours per day and 60 minutes per hour.
TRUNC (SYSDATE) + ((RONDE (t_minutes + s_minutes-5.01,-1)) / 24 / 60) is that the number of days after midnight today.
To_char (TRUNC (SYSDATE) + ((RONDE (t_minutes + s_minutes-5.01,-1)) / 24 / 60), "Hh: mi AM") is from this point in time, in ratings "Hh: mi AM ', for example ' 04:40 '. Oracle dATEs always include year, month, day, hour, minute and second. In this case, we are only interested by the hours and minutes, but to use TO_CHAR set a number of minutes in the desired format, needed us a DATE out of it, which is why, in the last two stages, we converted a number of minutes to several days and then added this number at midnight on a day. Since we are ignoring the year, month and day, it didn't matter that day, we used; Today it happens to be convenient.

As I need to work to

Round [A_TIME]
Gather also [A_TIME]

The rounding down modes, use the previous expression as your model:

,       TO_CHAR ( TRUNC (SYSDATE) + ( TRUNC ( t_minutes - s_minutes
                                             , -1
                               )
                          / 24
                          / 60
                          )
            , 'HH:MI AM'
            )          AS a

Tags: Database

Similar Questions

  • Best way to track the time of calculation of planning

    Hello

    Our management has asked us to provide monthly reports of the time of calculations in our main application of planning.

    We have identified one or two global level calculations we want to follow.   We run these calcs about 6 times a day on average.

    But it is almost impossible to sort through the massive application log (when presentations are completed) and filter it down (we tried, but newspaper is very difficult to work with).

    Has anyone developed a simple method (automatic) for the monitoring of the amount of time it takes for a calculation specific to planning?   We use calc Manager by the way to expand our rules and rulesets.   Ideally, we could get some kind of automated report which showed us the cases when the specific rule / ruleset ran and the duration of each instance.

    Thank you
    Mark

    Hi Mark,

    If these are calc manager rule, you should have all the necessary details in the HSP_JOB_STATUS table. You may be able to get this information from a simple query on this table. However, this information is also available in your planning application via Tools-> "Work Console" option, you will not see the time of calculation. It shows only the start and end time.

    Kind regards

    Sunil

  • Date/time field calculation

    Hi Experts,

    Our requirement is in the Service request object when one of the values from the drop-down list is changed into announcements, then the column date deadline must fill in with the value of the 4 hours added to the current date/time date/time.

    How to get there. Therefore, I see no function to perform calculations on date/time fields.

    Immediate response is appreciated.

    Thank you and best regards,
    Lemu

    Hello
    You will need to create a WF for this.
    Name of WF: Change status
    Raises the event: before save modified record
    Record Service of Type request:

    In Action of WF
    Name: Update Date
    Type: field update
    Field name: Your domain name
    value: Timestamp() + Duration ('P0Y0DT4H')

    It's your problem.

  • Convert the data to the time field of FFT

    I have a .tdms of signal data file EMG, signal represented by the number of samples and amplitude (data 24 bits). I want to perform this signal in a time domain analysis spectral EMG signal.
    I look forward to help me continue my project.

    I send all write file file and read the EMG signals signal

    Thank you very much.

    P/s: reading EMG Signal read data file sEMG_1.tdms

    EMG monitor write EMG signal acquisition at sEMG_1.tdms

    As has been pointed out by Dennis, you need timing information. A one-way ticket (since you don't save it not in the file), must have the user to enter the frequency of sampling on the analysis of VI.

    Ago probably more appropriate than graphics cards. Graphics work best when it acquires a point at a time, while the graphics are better for data blocks.

    Lynn

  • Fill in the time field, based on the checkbox

    I am trying to find a script to do the following:

    If checkfield.rawValue = "1" (checked)

    timefield.rawValue = (current time)

    If checkfield.rawValue = "0" (unchecked)

    timefield.rawValue = 'null '.

    Any ideas or suggestions would be greatly appreciated.

    Thank you.

    Here's a modified version. Display BBS of the script added additional characters that mess. I moved the code to the change event of the box (I think it's nicer whne the user clicks to see the change rather than leave the checkbox). Validate the e Th message was because you had a pattern on the ground and time resulting does not match. I deleted the template as well as disable the validation script message.

    Paul

  • view the log by using the time field a date of last year start date

    As the new year begins, I notice that if I try to do a 'show log beginning December 28 00:00:00 ' to get all the logs that surrounds an event of last week, I get no results. Most likely because the router's view I want newspapers beginning December 28, 2016, who has not yet arrived.  This command must be modified to use the * last * appearance of the starting date, not the date of beginning of this calendar year.

    This has been fixed in 5.2.3 and 5.3.0 increase CSCud91074

    Thank you

    Sam

  • 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 value

    Send 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

  • time fields

    Hello world

    I created a small database and one of the tables must have the time fields, I've ever used. The target table is a CALENDAR and its fields must be 'id_schedule', 'id_doctor', 'date', 'start_time', and 'finish_time '. Its purpose is to bring together the records of specific times of a certain day one where a doctor will be assigned to work.

    I have something like:

    create table attached
    (id_schedule number (5) Primary Key,)
    id_doctor number (5) references doctor (id_doctor).
    date of date_schedule,
    start_time time,
    finish_time time,
    check (finish_time > start_time)
    );

    I get the error: "invalid data type.

    In addition, is this how I should architect this table, I mean, something like this work properly? The times of departure and arrival for some days?

    Thank you

    Chiapa

    Hi, Chiapa,

    Chiapa wrote:
    Hello world

    I created a small database and one of the tables must have the time fields, I've ever used. The target table is a CALENDAR and its fields must be 'id_schedule', 'id_doctor', 'date', 'start_time', and 'finish_time '. Its purpose is to bring together the records of specific times of a certain day one where a doctor will be assigned to work.

    I have something like:

    create table attached
    (id_schedule number (5) Primary Key,)
    id_doctor number (5) references doctor (id_doctor).
    date of date_schedule,
    start_time time,
    finish_time time,
    check (finish_time > start_time)
    );

    I get the error: "invalid data type.

    Right; There is no TIME data type. (No wonder that you have never used it!)

    In addition, is this how I should architect this table, I mean, something like this work properly? The times of departure and arrival for some days?

    Why not make start_time and finish_time two DATEs? (Remember, DATEs in Oracle, always include the hours, minutes and seconds.) The name of 'DATE' is a little misleading). In this way, you have a shift that began at, say, 23:00 on 5 December 2012 and ending at 07:00 on 6 December. Call thedate_date_hour and finish_ start_ columns if you wish.
    You need a column separate date_schedule.

    Aside from that, your code seems to be well. The CHECK constraint, in particular, looks like a good idea; You can do the same thing if start_time and finsih_time are the two DATEs.

  • frustrating problem with a dat/time field

    I'm pretty new to this tool (LiveCycle) - once more to try to modify/create a pdf form on very simple writing

    I inserted 2 fields of date time. I have a correctly configured automatically insert the current time, when the form is opened so the user does not have to do... ;

    The following field must be a time field so that the user does not enter anyone.

    I have the date field load properly, but for the life of me cannot get the time to display at all.  I tried:

    1 Add a new date/time field

    2 duplicate one that works and just change the format of 'Time '.

    3 tried to remove them both and then create again.

    I discovered by removing both and starting, as I can get the date to appear in these two areas, but I can't do anything else to appear.  I can not get the time to appear in each area. !!

    Frustrated: Somebody can tell me what I'm doing wrong here...

    Because I don't see a place for me to download the form here, I posted on the following Web site

    I think you just download it and take a peek - if someone would be so kind - could explain things better to see for yourself.  It seems buggy to me, but I do not know!

    Thanks in advance,

    Dan has.

    See: http://provsnusa.com/test.html

    Hi Dan,.

    The time field was still date in script functions, although you use a time model (in the object > field > models).

    Just changed the script for:

    Current time in short-style date format.

    $ = num2time (Time (), TimeFmt (1))

    Here is the form: https://acrobat.com/#d=63FQyQ3bVTlj8ERIjvUGJw

    Good luck

    Niall

  • How to compare the time slices in 15 minutes?

    Using Flash 8 Pro AS2

    Have an animation to play once at the first visit to the site, regardless of the number of pages visited within the site. Then start over when to return to site.

    I thought that SharedObject would work for this. I managed to do it run at the same time to visit the site and the value of the shared object. Problem is that the animation NEVER play again because the shared object is never removed.

    Is there a way to put so it was like a session then that would solve this easy. I don't know how to do if there is a way.

    So I decided to make the swf file to check the page reload or if come back once again, site 15 minutes has elapsed. If so, update the time in being shared right now and the animation playback.

    Problem is that I have NO idea how compare the time set in the shared object at the moment to check whether or not the 15 minutes has passed.

    I tried different things, but the comparison, at the end of the hour, goes into the negative numbers. I am here minutes passing between saved time and the current time. Nothing else for a few minutes.

    I'm not a mathematical genius or understand all the stuff that I see out there in the tutorials and code examples, when it comes to the date and the time of calculation.

    I need to be. Delete the shared object to the closure or the site navigation browser.
    OR
    Check if 15 minutes has passed then at day time in the shared object and read the animation

    I'm just stuck in the calculation of time to determine whether or not the 15 minutes passed.

    What happens if they return to the site of the days or even weeks? My minutes of follow-up test has no meaning when entering hours and days or even weeks or months. Of course, my approach does NOT work.

    Any help would be great. Don't forget to Flash 8 pro and AS2 NOT AS3 or flash 9.


    Thank you

    I don't know how you look at the time, but if you create a DATE object:

    var today: Date = new Date(); It's actually an object of date and time.

    So, if you compare this date and time with an earlier date object and the object of time by using the Date method getTime() as follows

    Now.getTime () - previousDate.getTime () = the number of milliseconds that have elapsed between the "previousDate' and 'now '. If the difference is > 15 * 60 * 1000, 15 minutes.

  • Time sheet calculation of time fields (TimeIN + TimeOUT) - (BreakIN + BreakOUT)

    Hello


    I'm really a novice in the field of pdf script, I would like to ask if someone could help me make a calculation script of a time field with a TOTAL production WORKED HOURS in a day to a calculation of

    (TimeIN + TimeOUT) - (TimeBreakIN + TimeBreakOUT)

    still other topics that the TimeIN, timeout, the TimeBreakIN or the TimeBreakOUT can also run through midnight

    I'm looking for other forums, but not found anything that could match my needs.

    Time at: 17:00

    TimeBreakIN: 20:00

    TimeBreakOUT: 21:00

    OUT time: 02:30

    the script that I expected to be in the

    TOTAL HOURS WORKED is: 8.50 (or 08:30)

    I will be also repopulate this script to each row/day until I add in 1 pay as a TOTAL period

    Thanks in advance to those who can help me.

    Hi JunPapay,

    You may want to take a look at this: calculations between two time fields

    Thank you

    Abhishek

  • Reset the Date/time field

    I have a form I created a Date/time field that automatically fills when open.  I also have a reset button so users can reset the form empty.  I'm trying to figure out how to erase all of the data entered on the form and also to reset the date and time.  I could also have the set button to print the form and then erase all data and reset the date/time field?

    Figured it out.  Just need to set the value to the field calculated - read only and execution property: current Date/time

  • Convert the text to a char to convert a standard military time field

    Hi all

    I am trying to change a time field military winter time. The field is a text SSRMEET_Begin_time field that stands at 15:00 (as for example). I need to convert this output 03:00. I try it in a calculation Discoverer Desktop version 10.1.2.1 field, but I only see the to_char conversion, which I do not know how to properly set the declaration for the conversion.

    Any help would be greatly appreciated.

    Thank you!

    Hello
    Try to create this calculation:

    TO_CHAR (to_date (' 15:00 ',' HH24 '), ' Hh: mi AM ")

    * If you have no need for the AM/PM indicator remove the 'AM' of the formula

  • Calculation of the time wall of a SQL query.

    Hello

    While trying to discover the time of running a SQL query (wall time) I read in one place that CPU_TIME/EXECUTIONS of v$ SQLAREA, is the precise runtime we can come close to.

    I can't use "set timing on ' or 'DBMS_UTILITY. GET_TIME' that I need to extract the execution time of the story because the query will be drawn to an end, and I need to know how long it took to DB level and compare it with the end time before calculating the % of time used in the DB level total.

    Maybe another way to track sessions and the user TKPORPOF but now I donot want to take the help of the ADMINISTRATOR at this initial stage.

    Is CPU_TIME/EXECUTIONS of v$ SQLAREA where (SQL_TEXT) AS "SELECT... OF... %'; should be enough?

    user2925917, yes as Brian already answered your understanding as posted above seems correct.  Except in the case where there has been only a running query you will download an average time.  The problem with averages is that one or two unusual executions that can skew the average, but in most cases the average will be probably fairly accurate.

    - -

    HTH - Mark D Powell.

  • Behavior of the data import wizard when he meets a date/time field

    Hello

    Recently, I downloaded SqlDevelper 4.1.2.20 and used the wizard importing data for the first time.  In general, this has been a process easy and simple to use.

    I noticed a strange behaviour and I was wondering if that was seen by someone else.

    On importing data from an Excel worksheet, I met several fields with the date/time data,

    The Import Wizard is almost always empty the format field and showed in the "Columns of data sources" section this column and EACH column of data once it is in error.

    Once you get the correct format, I often found that I have to press the 'Back' button to clear the other columns of data to be deceived.   And, in some cases, I saw where the columns previously posted were then marked as error.

    Basically, anything after the column date corrected was wrong until an update of the "Source of data columns" has been done.

    If anyone else has noticed this?

    RandyN

    haven't noticed, does not mean that it is not a problem

    If you are an employee of the Oracle, send me an email with the details

    If you are not an employee of the oracle, email me anyway, with your sample excel worksheet and table DDL and I'll take a liquidator. Or open an SR with MOS (preferred)

Maybe you are looking for