Time Comparison PHP

Hi There
I am trying to create a time comparison for a website I am building.
I have the following so far
<?php
$date=$_POST ['daydropdown'];
$month=$_POST ['monthdropdown'];
$year=$_POST ['yeardropdown'];
$datevalue="$date/$month/$year";
$booking=strtotime ("now + 24 hours");
if ($date_value > $booking)
echo ("lovey");
else
echo ("tut tut");
?>
which is pulling its date info from
          <form action="timetest.php" method="post">
          <table>
  <tr>
    <td class="tableheight">
      Party Size</td>
    <td>
      <select name="partysize" size="1" id="partysize">
      <option>1</option>
      <option selected="selected">2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
      <option>6</option>
      <option>7</option>
      <option>8</option>
      <option>9</option>
      <option>10</option>
      <option>11</option>
      <option>12</option>
      <option>13</option>
      <option>14</option>
      <option>15</option>
      <option>16</option>
      <option>17</option>
      <option>18</option>
      <option>19</option>
      <option>20</option>
    </select>
    </td>
  </tr>
  <tr>
    <td class="tableheight">Date</td>
    <td>
<select name="daydropdown" id="daydropdown">
</select>
<select name="monthdropdown" id="monthdropdown">
</select>
<select name="yeardropdown" id="yeardropdown">
</select>
</td>
  </tr>
  <tr>
    <td class="tableheight">Time</td>
    <td><select name="time">
      <option>12 noon</option>
      <option>12:15pm</option>
      <option>12:30pm</option>
      <option>12:45pm</option>
      <option>1:00pm</option>
      <option>1:15pm</option>
      <option>1:30pm</option>
      <option>1:45pm</option>
      <option>2:00pm</option>
      <option>2:15pm</option>
      <option>2:30pm</option>
      <option>2:45pm</option>
      <option>3:00pm</option>
      <option>3:15pm</option>
      <option>3:30pm</option>
      <option>3:45pm</option>
      <option>4:00pm</option>
      <option>4:15pm</option>
      <option>4:30pm</option>
      <option>4:45pm</option>
      <option>5:00pm</option>
      <option>5:15pm</option>
      <option>5:30pm</option>
      <option>5:45pm</option>
      <option>6:00pm</option>
      <option>6:15pm</option>
      <option>6:30pm</option>
      <option>6:45pm</option>
      <option>7:00pm</option>
      <option>7:15pm</option>
      <option>7:30pm</option>
      <option>7:45pm</option>
      <option>8:00pm</option>
      <option>8:15pm</option>
      <option>8:30pm</option>
      <option>8:45pm</option>
      <option>9:00pm</option>
      <option>9:15pm</option>     
</select></td>
  </tr>
  <tr>
    <td class="tableheight">First Name</td>
    <td><input name="firstname" type="text" placeholder="Your First Name" /></td>
  </tr>
  <tr>
    <td class="tableheight">Surname</td>
    <td><input name="surname" type="text" placeholder="Your Last Name"/></td>
  </tr>
  <tr>
    <td class="tableheight">Email Address</td>
    <td><input name="email" type="email" placeholder="Your Email Address"/></td>
  </tr>
  <tr>
    <td class="tableheight">Confirm Email </td>
    <td><input name="confirm" type="email"  placeholder="Confirm Email"/></td>
  </tr>
  <tr>
    <td class="tableheight">Contact Number</td>
    <td><input name="contactnumber" type="text" placeholder="Your Contact Number"/></td>
  </tr>
  <tr>
    <td style="padding-top:0px"><input name="Book Now" type="submit" value="Book Now" /></td>
    <td></td>
  </tr>
</table>
          </form>
          <script type="text/javascript">
//populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select)
window.onload=function(){
populatedropdown("daydropdown", "monthdropdown", "yeardropdown")
</script>
What I want to happen is if a booking for a table is made for more than 24hours in advance then its fine and sends the reservation to the restaurant aka "Lovely" where as if its for within the next 24 hours then "tut tut" they are told to ring the restaurant.
Does anyone have any pointers for me please.
G

You need to change the $datevalue variable to a timestamp like you did with $booking.
$dateTried = strtotime($datevalue); 
Then you can compare them.
if ($dateTried < $booking) {      // this is what to do if the time chosen was within 24 hours } else {      // this is what to do if the time chosen was a valid value (24 hours or more from current time) } 
BTW, it looked like your form fields are populated using JavaScript. If I were you I would switch that to be PHP driven. The code will be very similar in PHP as your JavaScript code, but it will work for all your visitors, not just the ones that have JavaScript enabled.
-Jason
Sorry the code didn't line up. I used the wrong code insert options.
Message was edited by: UteFanJason

Similar Messages

  • Database time comparisons from RAT

    I am using Real Application Testing to test moving to a new server and I am a little confused on the “database time” comparisons. I ran the capture for 5 minutes and 54 seconds, the database time for the CAPTURE shows 33 minutes and 29 seconds, when I replayed it the REPLAY shows database time for 6:09 but the actual duration was only 5:57.
    So this tells me that it took about the same amount of time to play back the workload but I don’t understand the database time. Can somebody help me out with this? Thanks.

    I have not done RAT but my guess is the CAPTURE time is the cumulative time consumed by sessions on database for the given workload.

  • Stored Procedure using Date/Time Comparison

    I’m running SQL Server 2012. I need to write a procedure that will send out emails based on a date/time comparison.
    In my table, ‘tickets’, I have a smalldatetime column ‘ticket_date’ and another column ‘responded’ which is a bit field. I need to check the current date to see if 24 hours has passed from the ticket_date. If 24 hours has passed and responded is 0, then
    I need to email a manager ( I already have the code for  emailing with SMTP).
    The next step is to see if 48 hours has passed from the ticket_date and if responded is 0.
     If this is true, then I need to email someone else.
    I don’t want to include weekends in my time comparison. My procedure will only run Mon – Fri. 
    Thanks in advance!

    Check the below sample and hope this will help you:
    DECLARE @Tickets TABLE (TicketID INT, TicketDate SMALLDATETIME, Responded BIT)
    INSERT INTO @Tickets
    SELECT 1, '01/10/2015 10:00AM', 0 UNION ALL
    SELECT 2, '01/13/2015 12:00PM', 1 UNION ALL
    SELECT 3, '01/12/2015 05:30PM', 0 UNION ALL
    SELECT 4, '01/09/2015 08:00AM', 1
    SELECT *, '24 Hour' AS TicketCase
    FROM
    @Tickets
    WHERE
    Responded = 0
    AND DATEDIFF(HOUR, TicketDate, CURRENT_TIMESTAMP) <= (CASE DATEPART(WEEKDAY, TicketDate) WHEN 7 THEN 48 WHEN 1 THEN 24 ELSE 0 END) + 24
    UNION ALL
    SELECT *, '48 Hour' AS TicketCase
    FROM
    @Tickets
    WHERE
    Responded = 0
    AND DATEDIFF(HOUR, TicketDate, CURRENT_TIMESTAMP) >= 24
    AND DATEDIFF(HOUR, TicketDate, CURRENT_TIMESTAMP) <= (CASE DATEPART(WEEKDAY, TicketDate) WHEN 7 THEN 48 WHEN 1 THEN 24 ELSE 0 END) + 48
    Output
    TicketID | TicketDate | Responded | TicketCase
    3 | 2015-01-12 17:30:00 | 0 | 24 Hour
    1 | 2015-01-10 10:00:00 | 0 | 48 Hour
    You can make the separate SQL statements and email to proper people based on 24 hour or 48 hour case. 
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • Date and Time comparisons...

    Hi! and regards to all.... I´m trying to get the interval from a table depending on current date and time (sysdate), but i´m having problems when comparing date where first one is greater than second one...
    My table is defined and populated as...
    HRA_ID HRA_INTERV HRA_INICIO HRA_FIN
    1 15 01/01/2008 08:00:00 a.m. 01/12/2020 10:00:00 p.m.
    2 30 01/01/2008 10:01:00 p.m. 01/12/2020 07:59:00 a.m.
    Whend doing comparison between 8:00am to 10:00pm no problem is found and the data 15 is returned... but when comparing in the second interval (10:01pm to 7:59am next day) problems are come.. I supose is because of different days are considered in my sql statement... nevertheless i would like to receive comments...
    My sql statement is:
    SELECT HRA_INVERV
    FROM UBI_HORARIOS A
    WHERE TO_DATE(TO_CHAR(SYSDATE,'HH24:MI:SS'),'HH24:MI:SS')
    BETWEEN (TO_DATE(TO_CHAR(A.HRA_INICIO,'HH24:MI:SS'),'HH24:MI:SS'))
    AND
         (TO_DATE(TO_CHAR(A.HRA_FIN,'HH24:MI:SS'),'HH24:MI:SS'))
    Your suggestions are welcome...

    Thanks Justin!!, and EXACTLY!!!... That was the first error I found when my supervisors gave me the database ralational diagram... But in this case fields with data type TIME are not allowed.. So, what I´m trying to to is trim the date parte of the field (01/01/2008, etc,etc) and JUST USE TIME INTERVALS... That´s why I´m using to_char and to_date... in order to ELIMINATE DATE PARTS AND USE JUST THEIR TIME PERIODS... But being honest.. i don´t know if there´s another function could help...

  • Time Comparison

    Dear Friends,
    I need your valuable suggestion to proceed.
    Functional Flow :-
    My client will have a Construction project with a budgeted hours to finish and the Manager will assign Employees to this project. they need to know all the budgted hours are allocated to Employees to finish the work.
    Technical
    for example the budgeted hour will be in the format of 50:30 (Means 50 hrs and 30 minutes) and Workers will be allocated to this project like
    Monday 8:00 to 17:15
    Tuesday 9:00 to 16:45
    Tables := Projects Column Budgeted_hours varchar2(6)
    Assignments Column Allocated_hours varchar2(6)
    My question is how to compare the budgeted hours and allocated_hours of the workers to see whether all the budgeted hours are allocated to workers as I am storing these all values in Varchar2. Why I am using Varchar2 is that, they want to have this ':' sign with time slot.
    Can anyone help me how to do this. Whether I need to change varchar to Date ? if so the data will be inserted with date and time which is not correct for this situvation. Need help
    Please write to me at [email protected]
    Regards
    SJK
    thanks
    Sjk

    I would suggest you store elapsed time as a number of days e.g. 50:30 hours = 50.5/24 days = 2.1041666667 days. You'd need to write some simple PL/SQL database functions to parse and convert data between the numeric stored format and the desired input/output character format. The reasons for this are
    1) arithmetic becomes simple e.g. adding another 8 hours to the budgeted 50.5 hours
    2) where appropriate, it coincides with Oracle's way of handling date arithmetic (the difference between two DATEs is a NUMBER of days.
    If you can determine an employee's total number of allocated hours, then the comparison you mentioned becomes easy: unallocated = budgeted - allocated. You can also
    Your problem introduces lots of complexity due to the fact that a project day is not the same as a 24 hour calendar day (e.g. employee shift is only 8 hours, 5 days a week). Any calculation involving start or end dates will have to take the project calendar and work shifts into account. I suggest you invest some deep thought into the fundamental data manipulations needed by your project, and create a package of simple functions and procedures to form the foundation for higher level operations. Here's one example:
    FUNCTION SHOW_AS_HHMM (p_durn IN NUMBER) RETURN VARCHAR2 IS
    l_hours_n NUMBER;
    l_hours_c VARCHAR2(16);
    l_minutes_c VARCHAR2(2);
    BEGIN
    -- convert days into hours
    l_hours_n := p_durn * 24;
    -- convert hours into characters
    l_hours_c := to_char (trunc (l_hours_n));
    -- convert fraction of hours into minutes characters
    l_minutes_c := to_char (round ((l_hours_n - trunc (l_hours_n)) * 60));
    return l_hours_c || ':' || l_minutes_c;
    EXCEPTION
    WHEN OTHERS THEN
    raise;
    END show_as_hhmm;

  • Nested repeat Region - run time var PHP

    I have tried several attempts at creating a nested region
    with no luck of sucess
    sql & PHP
    There are 2 record sets
    rsProduct and
    rsCourse
    rsProduct
    SELECT *
    FROM svProductList
    WHERE svProductList.productOrder
    ORDER BY productOrder ASC
    rsCourse
    SELECT *
    FROM trainingCourseTBL
    WHERE trainingCourseTBL.product = colname
    ORDER BY trainingCourseTBL.courseOrder ASC
    colname
    type numeric
    default value -1
    runtim value $row_rsProduct['productOrder']
    Start repeat region 1
    rsProduct.productName
    Start repeat region 2
    rsCourse.course
    END repeat region 2
    END Start repeat region 1
    I would like to set up a run time var for the rsCourse where
    I get the value from the first repeat regions productID
    Can someone point me towards the right direction?

    On 21 May 2007 in macromedia.dreamweaver.appdev, cdembek
    wrote:
    > Can someone point me towards the right direction?
    I don't have time for a long explanation right now, but do a
    web search
    for 'Nested Repeat Region'.
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • Unable to insert current time from PHP

    Hi: how do I insert the current time into a DATE field in the database. This is what I have and does not work.<br><br>
    $currTime = 'to_date('.date("m/d/Y H:i:s", time()).', "MM/dd/yyyy HH:mm:ss")';<br>
    $sql = 'insert into IMPACT_EMAIL_ACTION (PRIORITYID,OSFILTER,EMAILADDRESS,CREATEBY,ACTIONEXPIRE,STOPPROCESSING,REQUESTDATE) VALUES (:priority,:osrule,:eaddress,:createby,:expire,:stopprocessing,:reqtime)';<br>
    $insertcusror = oci_parse($conn, $sql);<br>
    .<br>
    .<br>
    oci_bind_by_name($insertcusror, ':reqtime', $currTime);<br>
    .<br>
    .<br>
    $ok = oci_execute($insertcusror);<br>
    <br>
    I get the following error with the above code.<br>
    oci_execute() [function.oci-execute]: ORA-01841: (full) year must be between -4713 and +9999, and not be 0 in /export/home/rawlog/lsws/DEFAULT/html/action.php on line 488<br>
    In my log file when I print $currTime, this is what I see<br>
    [STDERR] to_char(02/14/2007 10:05:15, "MM/dd/yyyy HH:mm:ss")<br>
    <br><br>
    Thanks<br>
    Ravi<br>

    had to use
    $currTime = date("m/d/Y H:i:s", time());
    $sql = 'insert into ' . $tableName . ' (PRIORITYID,OSFILTER,EMAILADDRESS,CREATEBY,ACTIONEXPIRE,STOPPROCESSING,REQUESTDATE) ';
    $sql .= "VALUES (:priority,:osrule,:eaddress,:createby,:expire,:stopprocessing,TO_DATE('$currTime', 'mm/dd/yyyy HH24:MI:SS'))";
    couldn't bind it...

  • Getdate() and time comparison

    Hi all, I've SBO and I'm trying to create a query, based on OQUT table, showing DocNum WHEN time of creation of the offer is less then 15 minutes than System time. I'm trying to compare DocTime and the time extracted with getdate() but I'm not able to do it. I think it's a problem of data type.
    Is there anybody who can help me?
    Thanks in advance

    Hi Federico,
    You're correct, it's not possible to directly use DocTime for date comparisons because it's held as an integer value and not a DateTime value. You can do a little conversion though. Have a look here:
    Re: GetDate() in query generator doesn' return the time!
    Kind Regards,
    Owen

  • MM_XSLTransform error every time in PHP page

    When I apply an XSL Transformation to a PHP page, the page
    displays with an MM_XSLTransform error saying the XML file is not a
    valid XML document -- even though it absolutely
    is valid XML. This is totally reproducable.
    Here's a simple example:
    library.xml:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <library>
    <owner>Mister Reader</owner>
    <book>
    <isbn>1-2345-6789-0</isbn>
    <title>All About XML</title>
    <author>John Doe</author>
    <language>English</language>
    <price currency="usd">24.95</price>
    </book>
    <book>
    <isbn>9-8765-4321-0</isbn>
    <title>CSS Made Simple</title>
    <author>Jane Smith</author>
    <language>English</language>
    <price currency="usd">19.95</price>
    </book>
    </library>
    library.xsl:
    <xsl:stylesheet version="1.0" xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="iso-8859-1"/>
    <xsl:template match="/">
    <h1><xsl:value-of select="library/owner"/>'s
    Library</h1>
    <xsl:for-each select="library/book">
    <p><em><xsl:value-of
    select="title"/></em>
    by <xsl:value-of select="author"/>
    (ISBN <xsl:value-of select="isbn"/>)</p>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    library.php:
    <?php
    //XMLXSL Transformation class
    require_once('includes/MM_XSLTransform/MM_XSLTransform.class.php');
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    <body>
    <?php
    $mm_xsl = new MM_XSLTransform();
    $mm_xsl->setXML("library.xml");
    $mm_xsl->setXSL("library.xsl");
    echo $mm_xsl->Transform();
    ?>
    </body>
    </html>
    When viewing the file library.php, the following error is
    displayed in the browser, followed by the raw XML:
    library.xml is not a valid XML document.
    Non-static method DOMDocument::loadXML() should not be called
    statically, assuming $this from incompatible context in file
    library.xml.
    I wonder whether there is a problem with the include file
    MM_XSLTransform, version 0.6.2. Since that include file begins with
    a "TODO" note from the programmer, I wonder whether it's not quite
    release-ready.
    Anyone else having this problem?
    Environment:
    - Testing Server on localhost
    - Windows XP Pro SP2
    - Dreamweaver 8.0.2
    - PHP 5.1.4
    - MySQL 5.0.2.1
    - PHP MyAdmin 2.8.1

    Jon9999 wrote:
    > I wonder whether there is a problem with the include
    file MM_XSLTransform,
    > version 0.6.2. Since that include file begins with a
    "TODO" note from the
    > programmer, I wonder whether it's not quite
    release-ready.
    It was release-ready. It worked fine in PHP 5.0, but changes
    in PHP
    5.1.4 caused it to break. As I understand, Adobe is preparing
    a PHP
    hotfix that solves several problems caused by the 8.0.2
    updater. It also
    fixes this one.
    In the meantime, you can easily hand fix it yourself.
    Comment out line 301, which looks like this:
    $xml = DOMDocument::loadXML($content);
    Then insert the following two new lines immediately below:
    $doc = new DOMDocument();
    $err = $doc->loadXML($content);
    The rest of the script then continues with this:
    restore_error_handler();
    So, when you have finished, lines 301-304 will look like
    this:
    //$xml = DOMDocument::loadXML($content);
    $doc = new DOMDocument();
    $err = $doc->loadXML($content);
    restore_error_handler();
    Just in case you're interested in what the problem was: line
    301 uses
    loadXML() as a static method of the DOMDocument class. As of
    PHP 5.1.4,
    this isn't allowed. The substitute lines create a DOMDocument
    object,
    and then call the method on the new object.
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • Time Comparison and Calculation Questions

    Friends-
    I work in an industry where my scheduled work time is limited by statute.  And I have to do calculations for work legality that are based by looking back at actual times and forward at scheduled times.  The "DURATION" format is amazing because I can enter 5H 47M and it appears as I require.  I can also easily add with SUM my required times.  But that is the easy part.
    The hard part is it appears that while I can add and subtract DURATION formats, it is not a number, but a string.  (I think).  The problems I have are:
    1.  I need to populate a column for calculations (Calc Column) which includes either my Scheduled Time or Actual Time.  I need to look backward on actual times (regardless of which is greater or less) and forward on scheduled times.  I put that value in the Calc Column and do running totals for 28 days at at time.
    An IF statement would work perfectly here, if these were numbers, but unfortunately 0H 0M does not equal zero and I have been unable to make any If formula that states =IF(A1=0, X, X)   or   =IF(A1=0H 0M, X, X)   or   =IF(A1="0H 0M", X, X).    The only way I can test to see if a value is zero is with a string operator to look at 0H 0m and see zero's    =IF(MID(F44,4,1)+MID(F44,1,1)=0,E44,F44)
    Can anyone think of a more elegant way to test for whether a column contains 0H 0M.
    2.  I have to enter 0H 0M because I can't get any formulas to work on a blank cell.  I would much prefer to not see 0H 0M in the column and only see values on the days that I work.  But I have not been able to leave blank.  As you can see the only formula that works requires 0H 0M and not zero or empty.
    3.  Conditional formating:  I have tried to conditional format so that any time the value of a cell exceeds 95 hours it turns red.  But formatting works on values, and not on my 0H 0M string.
    Suggestions or solutions appreciated:

    Ian:
    Thanks, it almost worked perfectly, but not quite... 
    DUR2HOURS solve the biggest problem that I had.  Unlike in you sheet I do not calculate on a start and ending time.  I start with a scheduled time for the day, then a computer provides me an actual time for the day.  So Column E is Scheduled, Column F is Actual.
    DUR2HOURS allows the if statement you see below, namely to see if ACTUAL column is zero, it returns result of Scheduled.  Thank you, very nice solution and allows IF statement.
    Small issue still left, I would like to leave the says that I do not work displaying blank.  Currently I have to enter 0H 0M every day or else the dreaded little red triangle below.  So if I could make a formula that did not return the triangle the spreadsheet would read nicer and I could move onto the lookup function that is also not working!
    Thanks again for the excellent recommendation.
    JG

  • Time comparison in database

    I'm developing a attendance record for my company and I have the following issues.
    The table looks like this.
    Table name: Attendance,
    Structure is like this,
    staffID      int(11)      
    date      date
    time_in time
    time_out time
    Date      Time In Time Out
    2006-10-05     09:31:00     18:29:00
    2006-10-06     09:41:00     16:39:00
    Number of late: 2
    Total late seconds: 187200
    As I would like to compare the time_in against 09:30:00 and get a sum of the amount.
    MySQL statement is like this,
    SELECT * FROM attendance where staffid = '" . $staffid . "' AND time_in > '09:30:00'
    However the return time is 187200. I wonder how they calculate this and if the sql statement is the correct one.

    OK, I've modified customer average function found here,
    http://www.oracle.com/technology/oramag/oracle/06-jul/o46sql.html
    CREATE OR REPLACE TYPE SumInterval
    AS OBJECT (
    runningSum INTERVAL DAY(9) TO SECOND(9),
    STATIC FUNCTION ODCIAggregateInitialize
      ( actx IN OUT SumInterval
      ) RETURN NUMBER,
    MEMBER FUNCTION ODCIAggregateIterate
      ( self  IN OUT SumInterval,
        val   IN     DSINTERVAL_UNCONSTRAINED
      ) RETURN NUMBER,
    MEMBER FUNCTION ODCIAggregateTerminate
      ( self         IN  SumInterval,
        returnValue  OUT DSINTERVAL_UNCONSTRAINED,
        flags        IN  NUMBER
      ) RETURN NUMBER,
    MEMBER FUNCTION ODCIAggregateMerge
      (self IN OUT SumInterval,
       ctx2 IN     SumInterval
      ) RETURN NUMBER,
    MEMBER FUNCTION ODCIAggregateDelete
      ( self  IN OUT SumInterval,
        val   IN     DSINTERVAL_UNCONSTRAINED
      ) RETURN NUMBER  
    CREATE OR REPLACE TYPE BODY SumInterval AS
    STATIC FUNCTION ODCIAggregateInitialize
      ( actx IN OUT SumInterval
      ) RETURN NUMBER IS
      BEGIN
        IF actx IS NULL THEN
          dbms_output.put_line('NULL INIT');
          actx := SumInterval (INTERVAL '0 0:0:0.0' DAY TO SECOND);
        ELSE
          dbms_output.put_line('NON-NULL INIT');
          actx.runningSum := INTERVAL '0 0:0:0.0' DAY TO SECOND;
        END IF;
        RETURN ODCIConst.Success;
      END;
    MEMBER FUNCTION ODCIAggregateIterate
      ( self  IN OUT SumInterval,
        val   IN     DSINTERVAL_UNCONSTRAINED
      ) RETURN NUMBER IS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('Iterate ' || TO_CHAR(val));
        IF val IS NULL THEN
            /* Will never happen */
            DBMS_OUTPUT.PUT_LINE('Null on iterate');
        END IF;
        self.runningSum := self.runningSum + val;
        RETURN ODCIConst.Success;
      END;
    MEMBER FUNCTION ODCIAggregateTerminate
      ( self        IN  SumInterval,
        ReturnValue OUT DSINTERVAL_UNCONSTRAINED,
        flags       IN  NUMBER
      ) RETURN NUMBER IS
      BEGIN
        dbms_output.put_line('Terminate ' || to_char(flags) || to_char(self.runningsum));
        returnValue := self.runningSum;
        RETURN ODCIConst.Success;
      END;
    MEMBER FUNCTION ODCIAggregateMerge
      (self IN OUT SumInterval,
       ctx2 IN     SumInterval
      ) RETURN NUMBER IS
      BEGIN
        self.runningSum := self.runningSum + ctx2.runningSum;
        RETURN ODCIConst.Success;
      END;
    MEMBER FUNCTION ODCIAggregateDelete
      ( self  IN OUT SumInterval,
        val   IN     DSINTERVAL_UNCONSTRAINED
      ) RETURN NUMBER IS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('Delete ' || TO_CHAR(val));
        IF val IS NULL THEN
            /* Will never happen */
            DBMS_OUTPUT.PUT_LINE('Null on delete');
        END IF;
        self.runningSum := self.runningSum - val;
        RETURN ODCIConst.Success;
      END;
    END;
    /* create the aggregate interface function*/
    CREATE OR REPLACE FUNCTION sum_interval
      ( x DSINTERVAL_UNCONSTRAINED
      ) RETURN DSINTERVAL_UNCONSTRAINED
        PARALLEL_ENABLE
        AGGREGATE USING SumInterval;after running this script you should be able to get result like this,
    SQL> select sum_interval(numtodsinterval(time_in-to_date('9:30:00','HH24:MI:SS'),'day')) from att;
    SUM_INTERVAL(NUMTODSINTERVAL(TIME_IN-TO_DATE('9:30:00','HH24:MI:SS'),'DAY')
    +000000000 00:12:00.000000000Message was edited by:
    nurhidayat

  • Time for PHP?

    In case you haven't heard of PHP, it's only the webs most popular server side language: http://newsforge.com/newsforge/02/06/11/011243.shtml?tid=5
    It's the first Open Source project to come from behind and overtake the bespoke Microsoft solution: ASP.
    It's a great lanaguage which even has limited support for writing in Java: http://www.php.net/manual/en/ref.java.php
    What it's lacking is a solid development framework with tools for building web services. It is fully capable though, have excellent support for XML-RPC and some Open Source libraries in development for SOAP.
    So how about recognising it before we see a PHP.NET and provide support for it with the J2EE framework?
    Most PHP coders are application developers as opposed to frameworkers. But provide them an integrated tool within J2EE to build scalable PHP apps, in particular web services, and they'll no doubt be won over.
    That could make J2EE the framework for the Internet.

    You can use scriptlets in .JSP pages to acheive similar things.
    J2EE discourages this because it doesn't cleanly separate the presentation and business logic. The J2EE way to do this is with JSP / custom tags for presentation and EJB's for the business logic.
    A clean separation is hard to achieve nicely and you realise the benefits mostly on big multi-person projects.
    The reason PHP is popular is because it's easy to use for small projects and most websites are small operations.

  • Time comparison in UCCX scripting

    Hi,
    Need help in UCCX 8.5 scripting with opening and clsoing hours. I need to check for any incoming call if current system time is between 8 am to 5 pm then call should route to  CSQ otherwise it should route to voice mail.
    Regards,
    Dinesh Joshi

    Hi Dinesh,
    You can use the script and holiday xml file attached to this support forum as i recently worked on it.
    Please make sure to change the dates according to you needs in the XML file.
    https://supportforums.cisco.com/message/3930967
    In you original script you will need to use "call subflow step" this way the call will go to that script check for holiday and return to your original script.
    Use output mapping ( its available in the properties of call subflow step) to take the value of variable "todayIsAHoliday" and tore the value in a variable in the original script.
    Once that i done use "if step" to in properties todayIsAHoliday==ture
    true
    go to holiday prompt
    false
    go to continue with time of day check
    Regards,
    Chuck
    Please rate helpful posts and identify correct answers.

  • Time Comparison and Subtracting

    I have a requirement regarding time like i need to compare two time datatype fields, like Start time and End time, End time should not be greater than Start Time. Also Lunch break field will be entered in mins. So, now I need to display in a field Working = Start-End-Lunch. How can I subtract Time from Time and also Compare in Webdynpro Java

    Its more w.r.t. plain old Java.
    Look up in Java to use the Date/Time classes to subtract the times.
    Check this link for some clue into time subtraction in Java.
    http://www.mkyong.com/java/how-to-calculate-date-time-difference-in-java/
    Regards,
    Sharath

  • UCCX scripting time comparison

    hello all,
    I need your assistance.
    my customer wants to know for how long a call is been in the queue.
    I know how to get the time and keep track of the  time since the call was in the queue until the call was indeed anwered.
    my question is how do i make the math here
    when i grab the time the format is
    1:00:00 AM/PM
    I don't think i can just substract the time. do i need to divide the number into hours, minutes and seconds and then substract each of them individually and them put them together ? or whats the most efficient way to do it ?
    thanks
    I'm working on UCCX 8.5.1 SU3

    It's possible to do math on time values, but it's very cumbersome and it's difficult to do correctly. Bear in mind things like seasonal time changes, timezones, leap years, leap seconds, etc. The "Get Reporting Statistic" step would answer your question easily and directly.
    You can call that at any point during your caller's hold loop to see how long they've been waiting, in seconds. Naturally, if you'd like minutes, just divide the result by 60. If you're using that for some sort of holding-too-long escalation threshold, then that should be all you need. If there's some reason you need the hold time at the moment the call goes to the agent, you should be able to use Select Resource with Connect set to "no" and call it in the Selected branch, and then Connect the call, but I'm not sure why you would need that.
    If this doesn't solve your problem, please let us know exactly why and when you need the time in queue and we might be able to help more.

Maybe you are looking for

  • Creating PDF's from VISIO diagrams

    Hi, We are storing the VISIO documents in a network folder, we want to give users a TCODE in SAP to view these VISIO documents based on some criteria. To do so we want to convert it into PDF so that they can't Edit it accidentally. Appreciate your Id

  • Can the cheques automatically assigned to Down payment F-48

    Is it possible automatic cheque assignnment of next cheque from the cheque lot. I know we need to assign the cheque FCH5  in another transaction or we need to pay from F-58 or for manual cheque payment we can use f-53 and FCH5 . How to assign cheque

  • Problem applying text styling to css class

    Hi all, first off, apoligies if this is answered else were, I'm fairly sure its not but I cant seam to find any information on it. I may be complety missing it or I'm just looking for the answer with the wrong search terms. Anyway, my problem, I crea

  • Can you rearrange videos instead of settling for itunes alphabetical order

    I have a couple u2 videos and the Jack Johnson concert on my ipod. When I downloaded the concert to my computer it listed all videos in alphabetical order, it even mixed the u2 videos with the Jack concert. I just want a way to make the concert play

  • Session in Webservices using Axis 1.3???

    Hi, has anyone a link, tip, sample code,... how to create sessions in Webservices using Axis 1.3? I've got a Flex frontend... Please help me... Greetings, Chris