Sql ---sum of Date-time formate ......

id time
1 1.20
2 2.30
3 4.20
4 5.30
5 1.00
result expected = 14:40 or (if AM/PM so result is ???)
how can i calculate the sum of time ???
please give me some fast tricks of handling date/time formate in oracle....

942425 wrote:
id time
1 1.20
2 2.30
3 4.20
4 5.30
5 1.00
result expected = 14:40 or (if AM/PM so result is ???)
how can i calculate the sum of time ???
please give me some fast tricks of handling date/time formate in oracle....Hi,
First you post in wrong forum. Please post at PL/SQL
Before posting there close it and mark as answered.
if your time is number data type then you can try this
SELECT SUM(NVL(ROUND(TRUNC(DAC_OT_HOUR)+((TO_NUMBER (SUBSTR (DAC_OT_HOUR, INSTR (DAC_OT_HOUR,'.',1,1)+1)))/60)),0))
FROM DA_CHECKHope this helps
Hamid
Mark correct/helpful to help others to get right answer(s).*

Similar Messages

  • GregorianCalendar datetime format convert to  sql server date time format

    please help me
    my GregorianCalendar date time format is like this. *08/01/29 02:25:59* . I try to insert my database(sql server 2000 )
    data type is datetime ,in my database table display like this *2029-08-01 02:25:59.000* .can you help me to insert correct date in my database table like ( . *08/01/29 02:25:59*)

    use [PreparedStatement |http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html] and setTimestamp:
    [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]

  • Specifying date time format in Finder

    How can I specify the date-time format in Finder for the "date-modified" and "date-created" columns in list view?
    About three years ago, I got a command line instruction to set these formats and I kept it at mm/dd/yy
    Then a couple days ago, I changed the date format in iStat menus and the date-time formats started acting weird. I want the dates to be like "07/08/05" (mm/dd/yy) and then the formats started changing to "November 07, 2008" (month/dd/yyyy). This change seemed to take effect any time I open the view options for a folder. Now I discovered that the date format change depending on the column width according to the format specified in system preferences, international, formats.
    Narrow column, short date format; a little wider to long format, with ellipses if the column is not wide enough; then full format.
    Does anyone know the command line to set the format to keep it to the one I want?

    this doesn't seem to be it. however I now like the way Finder does display dates -- format gets more compact as the width of the column decreases; although there still is some excess space left on the left -- perhaps for AM & PM which I don't use; I use a 24 hour time format instead.
    Happy New Year

  • Convert Epoch Date Time to Date Time format

    I am trying to convert Epoch Date time in GMT to Human Readable Date time format in UTC. I used the one below but it returns just the date in GMT but how can get datetime in UTC ?
    select To_Char( To_Date( '01.01.1970 06:00:00','DD.MM.YYYY HH24:Mi:Ss') + STARTIME / 86400,'DD.MM.YYYY HH24:Mi:ss') FROM HQ_AVAIL_DATA_RLE;
    I refered a couple of forums and applied everything, but still I wouldn't get the timestamp.
    Please note that i'm looking for datetime stamp, not just the date.
    Thanks in advance!
    Edited by: 830754 on Jan 27, 2011 11:18 AM
    Edited by: 830754 on Jan 27, 2011 11:19 AM

    Works for me. I see date and time (submitted 1000 for STARTTIME):
    select To_Char( To_Date( '01.01.1970 06:00:00','DD.MM.YYYY HH24:Mi:Ss') + 1000 / 86400,'DD.MM.YYYY HH24:Mi:ss')
    from dual
    TO_CHAR(TO_DATE('01
    01.01.1970 06:16:40Or do you mean something else?

  • Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER

    Hi Experts,
    What is significance of Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER.
    Thanks,
    ABDUR

    I guess this would be applicable for the folowing formats - DATE, TIME, TIMESTAMP.
    This is the correct link
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    Regards,
    Prateek

  • How to get the date time format in OCI

    How to get a date time format in OCI instead of only date

    You would have to use the OCIDateTime datatype for this. Refer to
    OCI documentation for more details.

  • Wrong DATE-TIME FORMAT among REPORTS NOTIFICATION EMAILs

    Dear all,
    I create a report request with url
    https://ocixxxx2.oci.xxcl.net/reports/rwservlet?>destype=printer&desformat=PDF&server=rep_xxxxx2_orahome&userid=ixxxxxx/xxxxxxx@saas&notifysuccess=IASL&notifyfailure=IASL&report=R1000R13.rdf&jobname=R1000R13&desname=HPLaserJet4150PCL6
    Email notification was generated with wrong date format .
    It's expected to be in UK English but it shows encoded text , may be random. I route it to another email servers such that find the date time is in chinese characters . That caused problem on original email server in which was not supported
    Could any expert please advice ?
    Warmly
    Edited by: MosielleKwan on 2010年2月26日 下午11:31

    It's indeed an expected behavior.
    When a Reports Server starts on a Windows machine, it likely detect the Windows Regional Settings in order to use it when needed later. This let the Reports Server communicate in the same format/way the Server machine uses. For example, if the System / Application Server administrator prefers to use the Windows (on which the Application Server is installed) with Chinese Regional Options, it is normal that the Reports Server send the Notification Email with a "Date/Time" Format matches the Windows.
    Thence, you like to get English/Western Date and Time format in the Reports Server Notification Email, it is required to change the Windows Regional Settings from Chinese to English and restart the Reports Server and restart the corresponding compoent. This will let the Reports Server detect the change and will send the Notification Email(s) then with English/Western Date and Time formats.
    If English/Western Date and Time format in the Reports Server Notification Email but still have the Windows Regional Settings set to Chinese, you can implement it
    that :-
    1. Change the Windows Regional Settings from Chinese to English.
    2. Restart the Reports Server and restart others.
    3. Change the Windows Regional Settings back from English to Chinese. .
    With these 3 steps, the Reports Server will keep sending the Notification Emails with English/Western Date and Time format, and maintain original settings.

  • Changing date/time format

    Hi there,
    I live in the United States but prefer my dates to be in the dd/mm/yy format as opposed to the US mm/dd/yy format. I also like 24-hour time rather than AM/PM. I System Preferences>Language & Text>Region, I found the tool to modify my preferred date/time formats. However, I notice that the format of the date in my menu bar does not change (it still reads Sep 25 when it should read 26 Sep). All other dates/times appear to function correctly. I briefly switched the Region of the computer to the United Kingdom but quickly switched it back because of how autocorrect handled words like "color."
    Ideas?

    That did the trick - sometimes the easiest thing to do is hard to see. Seems I have been working too long on a Windows machine (unfortunately, I have to do so at work)...
    Thanks for the quick help!

  • Date time formatting issues!!!!

    guys,
    I am trying to format date and time in the same variable.
    heres my code...
    <cfset dtimes = LSDateFormat(now(),'YYYY-MM-DD
    h:mm:ss')>
    the problem is, that it gives me the year month and day
    correctly.... the hour correctly, but where the minute is supposed
    to go, it gives me the month again (which makes sense cuz obviously
    its the same characters)... and then seconds are ok too. how do i
    fix it so it gives me the correct minutes? Thanks in advance!!!!
    JE

    A limitation of CF functions there is not a single date &
    time format
    function you have to combine the two.
    <cfset dtimes = LSDateFormat(now(),'YYYY-MM-DD') & ' '
    LSTimeFormat(now(),'h:mm:ss')>
    johnegbert wrote:
    > guys,
    > I am trying to format date and time in the same
    variable. heres my code...
    >
    > <cfset dtimes = LSDateFormat(now(),'YYYY-MM-DD
    h:mm:ss')>
    >
    > the problem is, that it gives me the year month and day
    correctly.... the
    > hour correctly, but where the minute is supposed to go,
    it gives me the month
    > again (which makes sense cuz obviously its the same
    characters)... and then
    > seconds are ok too. how do i fix it so it gives me the
    correct minutes?
    > Thanks in advance!!!!
    > JE
    >

  • Batch file - how to Date & Time Format as January 6, 2014 - 8:54 PM Eastern

    Batch file - how to Date & Time Format as January 6, 2014 - 8:54 PM Eastern

    Hi Dhiravia,
    If you want to convert the month format, please refer to the batch script below:
    SET Month=%DATE:~4,2%
     if %Month%==01 set Month=JAN
     if %Month%==02 set Month=FEB
     if %Month%==03 set Month=MAR
     if %Month%==04 set Month=APR
     if %Month%==05 set Month=MAY
     if %Month%==06 set Month=JUN
     if %Month%==07 set Month=JUL
     if %Month%==08 set Month=AUG
     if %Month%==09 set Month=SEP
     if %Month%==10 set Month=OCT
     if %Month%==11 set Month=NOV
     if %Month%==12 set Month=DEC
     echo %Month%
    To convert the date format via cmd, please also check this article:
    http://myblog4fun.com/archive/2012/01/06/getting-the-current-date-and-time-from-bat-files.aspx
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Importing ansi date time format into diadem

    Hi,
    I have an ANSI data log txt file with the time channel format  30/03/2006 15:51:08.846 and i am trying import into DIADEM  using the date/time format dd/mm/yyyy hh:nn:ss.fff , but when the file is imported, the time channel cells appear as NO VALUE. Can anybody help please ?
    AdeK

    Hi Adek,
    Here is a DataPlugin which loads your data file into DIAdem 10.2.  There are a number of advantages to using a DataPlugin over the ASCII Import Wizard, so long as your data files follow a similar data file structure.  To register the DataPlugin, just detach the ZIP file, unzip the URI file within, then double-click on the URI file in Windows Explorer.  After that, you will be able to load your TXT data files by dragging&dropping them directly from the NAVIGATOR tree view or Search Results into the Data Portal on the right hand side of DIAdem.  DataPlugins also support selective loading, register loading, reduced loading, and DataFinder indexing, so all of these immediately become available to you with your TXT files.  Note also that header lines 2-4 are now declared as both File and Group properties.
    Ask if you have questions using the DataPlugin,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Adek_TXT.zip ‏2 KB

  • ConsoleOne lacking Date/Time-Format-Tab for Client-Setting

    I remember from GW6 the Client-Setting-Tab in ConsoleOne for Date-/Time-Format (for local german format)
    There is a tab with these settings in the GW8-Client, but I cannot find this specific setting in ConsoleOne.
    Any ideas?
    Sincerely
    Karl

    The availability in ConsoleOne with GW6.0 is confirmed. Now, since it seems to be gone with GW8.0, how would someone deal with the need of a central adjustment of this setting? At time I am running through the firm with setting this at the users workplace in the GW8.0-Client under Tools/Options/Calendar/Date-Time with hitting the button "Set to System" (or something like that - I have it in German).
    Sincerely
    Karl
    Originally Posted by laurabuckley
    Hi Karl,
    Personally, I don't recall such a setting in ConsoleOne.
    Sorry, not much use, just confirmation that you are not doing something wrong!
    Cheers,

  • Difference between LV 6.1 and LV 7.0 - Date\Time Format

    I found different behviour of numeric controls in Date/Time format, or
    in "Seconds to Date\Time String" function in LV6.1 and LV7.0
    In LV 6.1:
    Absolute time in seconds is formated in control with date/time format,
    output depends on local time format on computer, where this VI runs.
    So if I start LabView on machine with specific time zone, and for
    example DST on, the output was changed by these settings. ANY number
    of second is handled by this settings.
    In LV 7.0:
    Output still depends on specific time zone, but the use of the DST
    on/off depends on absolute time value. So if the number represents
    absolute time which fits period when DST was off, the output is
    wihtout DST, even if the DST is on when this vi runs.
    The solution in LV 7.0 is much more better than in LV 6.1, but ...
    If data are measured and stored (store of absoulte time DBL) in one
    time zone, and if they are processed in different time zone (for
    exapmle where DST change is in different time), the data
    representation is wrong.
    In LV 6.1 it was not correct too, but anyway there was a way how to
    solve this problem:
    I stored absolute time DBL and GMT delta for every time stamp. When I
    process this stored data on different computer with different time
    zone, I recalculate time stamps in this way:
    absolute time + stored GMT delta - GMT delta of computer where data
    are presented.
    So in final I have correct time does not matter on time zone or any
    other settings which are on computer where are data presented.
    But on LV 7.0, the GMT delta is not constant for every data and this
    algorithm is useless. I can simply show correct time when data are
    from same time zone without any calculation, but it is almost
    imposible to correct show data
    from different time zone.
    My question is:
    Is there any "ini file item", which can tell LabView 7.0 to use time
    representation style as in LV 6.1 ?
    Thank you and best regards
    Jiri Hula

    Thanks for the well written question.
    Unfortunately, there is no ini token or any way of specifying LabVIEW use the LV 6.1 style.
    I am attaching a LabVIEW 7.0 VI that calculates the UTC Offset for a given time value (I don't think the same code would work correctly in LabVIEW 6.1). The VI comments are:
    The attached VI will take Daylight Saving and Time zone into account to compute the offset in seconds from UTC Time to the Local time (as specified by the computer). Note: This VI can aid in converting from Local Time to UTC time, but not in converting from one Timezone to another.
    I hope it helps. Basically, your data is in UTC (absolute time) as it has always been, but LabVIEW 7.0 changed the way it displays the UTC data (trying to be more correct). If you wish to display it the way it was in LabVIEW 6.1, things are going to get a little tricky. LabVIEW 6.1 displayed the same DBL absolute time differently depending on if the current computer time was in DST or not. To get this behavior in LabVIEW 7.0, the equation:
    absolute time + stored GMT delta - GMT delta of computer where data are presented
    is still correct, but for LabVIEW 7.0 the GMT deltas now vary depending on whether the absolute time is in DST or not. It may be possible to convert the GMT offset you have saved from LabVIEW 6.1 into a set or pair of UTC Offsets. This would require a knowledge of what the DST state was for each of the data points in question.
    The DST state or GMT/UTC offset that the computer currently is using may be obtained from the attached VI.
    The absolute time is stored in GMT/UTC so that in different time zones it will still equate to the same time, even though it will be displayed differently. Another data format (such as storing the Hour, Minute, Second, Day, Month, Year; or storing the date as a string) might be more appropriate if the time should be displayed as the same local time regardless of the time zone.
    I hope this helps. Please respond if you have any comments or questions.
    Shawn Walpole
    Attachments:
    GetUTCOffset.vi ‏52 KB

  • SQL query for date & time interval

    Hello everyone,
    there is my problem
    I have to make a search for events that are taking place during inserted date & time .
    There's the table structure:
    event
    datefrom
    dateto
    timefrom
    timeto
    The problem is, when I try:
    select * from xyz where datefrom <= inserted_date and dateto >= inserted_date and timefrom <= inserted_time and timeto >= inserted time;
    then I don't get back all records.
    eg: user inserts date = 10.10.2010 and time 10:00 and in the table is event [abc 11:00 9.10.2010 -> 09:00 11.10.2010] stored following way:
    event         abdc
    datefrom   09.10.2010
    dateto        11.10.2010
    timefrom    11:00
    timeto         09:00
    => this event won't be found, because the sql logic compares only single parameters and not their context.
    Do you have any idea, how to solve this issue?
    Thank you.
    Lukas

    Hello Hubert,
    thank you very much for your proposal, but your code makes the same select as mine (but in a more user friendly look :).
    Table:
    datefrom 09.10.2010
    dateto 11.10.2010
    timefrom 11:00
    timeto 09:00
    Event date = 10.10.2010 and time 10:00.
    Your query:
    select * from xyz where 10.10.2010 between 09.10.2010 and 11.10.2010 (that's so far ok) and 10:00 between 11:00 and 9:00 (no return there, because 10:00 doesn't lie within interval 11:00 -> 9:00... actually no value lies there) ;
    Don't you have any other idea?
    Thank you
    Lukas

  • Pure SQL to partition date-time occurrences into non-overlapping windows?

    i've a question that so far, i've never been able to solve via a pure SQL option.
    it's hard to explain in words, but it's something like this:
    given a set of date-time, i would like to partition the data into non-overlapping windows of 30 minutes each.
    the data is supposed to be partitioned into windows of 30 minutes, meaning when the data is within 30 minutes of the first occurrence, only the first occurrence will be returned. in the next second after the 30th minute, the record will be considered as the start of a new window and is also returned. so those data that occurs within the window period are suppressed. the first occurrence is not necessarily occurring on the 00th minute, so the window start will never be constant.
    run the below query to look at the dummy data.
    SELECT     'A' AS ID
              , TRUNC(SYSDATE) + 7 / 24 + 1 *(ROWNUM - 1) / 1440 AS datetime
          FROM DUAL
    CONNECT BY ROWNUM <= 50
    UNION ALL
    SELECT     'A' AS ID
              , TRUNC(SYSDATE) + 9 / 24 + 8 / 1440 + 1 *(ROWNUM - 1) / 1440 AS datetime
          FROM DUAL
    CONNECT BY ROWNUM <= 35
    UNION ALL
    SELECT     'B' AS ID
              , TRUNC(SYSDATE) + 7 / 24 + 5 *(ROWNUM - 1) / 1440 AS datetime
          FROM DUAL
    CONNECT BY ROWNUM <= 15this is supposed to be the output.
    ID     DATETIME
    A     5/19/2010 07:00:00
    A     5/19/2010 07:30:00
    A     5/19/2010 09:08:00
    A     5/19/2010 09:38:00
    B     5/19/2010 07:00:00
    B     5/19/2010 07:30:00
    B     5/19/2010 08:00:00so far, i'm using a PL/SQL to pipe the records. but i would like to know if this is achievable via SQL or not.
    i've tried looking at analytics, width_bucket, ntile and alll options i can think of, but i just can't solve this at all.

    hey Bob,
    your answer is most definitely correct and does what i want. i've verified it again my data set and it returns the results as required!
    you've definitely proven me wrong. i was always under the impression that this wasn't possible. thanks!
    just a small note:
    i need the windows to be binned by seconds, so have changed the numtodsinterval to raw numbers.
    WITH t AS
         (SELECT 'A' AS ID
                , TRUNC(SYSDATE) +(6.75 / 24) AS datetime
            FROM DUAL
          UNION ALL
          SELECT 'A' AS ID
                , TRUNC(SYSDATE) +(6.75 / 24) AS datetime
            FROM DUAL
          UNION ALL
          SELECT     'A' AS ID
                    , TRUNC(SYSDATE) + 7 / 24 + 1 *(ROWNUM - 1) / 1440 AS datetime
                FROM DUAL
          CONNECT BY ROWNUM <= 50
          UNION ALL
          SELECT     'A' AS ID
                    , TRUNC(SYSDATE) + 9 / 24 + 8 / 1440 + 1 *(ROWNUM - 1) / 1440 AS datetime
                FROM DUAL
          CONNECT BY ROWNUM <= 35
          UNION ALL
          SELECT     'B' AS ID
                    , TRUNC(SYSDATE) + 7 / 24 + 5 *(ROWNUM - 1) / 1440 AS datetime
                FROM DUAL
          CONNECT BY ROWNUM <= 15)
        ,a AS
         (SELECT ID
                ,datetime
                ,LAG(datetime) OVER(PARTITION BY ID ORDER BY datetime) AS prevtime
                ,LAST_VALUE(datetime) OVER(PARTITION BY ID ORDER BY datetime RANGE BETWEEN CURRENT ROW AND 30 / 1440 + 1 / 86400 FOLLOWING) AS interval_end
            FROM t)
        ,b AS
         (SELECT ID
                ,datetime
                ,LEAD(datetime) OVER(PARTITION BY ID ORDER BY datetime) AS nexttime
            FROM t)
        ,ab AS
         (SELECT a.ID
                ,a.datetime
                ,a.prevtime
                   ,a.interval_end
                   ,b.datetime as b_datetime
                ,b.nexttime
            FROM a JOIN b ON(a.ID = b.ID
                             AND a.interval_end = b.datetime)
    SELECT     ID
              ,datetime
          FROM ab
    START WITH prevtime IS NULL
    CONNECT BY ID = PRIOR ID
           AND datetime = PRIOR nexttime
      ORDER BY ID
              ,datetime;this most definitely proves that i'm still not sure of how to use hierarchy queries.
    Edited by: casey on May 20, 2010 11:20 AM

Maybe you are looking for