Converting Time Difference to Human-Readable Time

Hello everyone,
I just posted a thread about an hour ago on how to get the difference between the current time and two tables. My results are as follows:
Call Moddate Modtime Age
Open     2009-04-09     13:47:08     2.57
The age is this command:
round((sysdate - to_date ( moddate | | modtime, 'YYYY-MM-DDHH24:MI:SS'))*1440, 2)
Is there a way to convert the result (2.57) to a HH24:MI:SS format?

Hi,
Solomon Yakobson posted a solution in that other thread that does exactly that.
with t as (
           select '2009-04-09' ModDate,'13:48:30'  ModTime from dual
select  numtodsinterval(sysdate - to_date(ModDate || ' ' ||  ModTime,'yyyy-mm-dd hh24:mi:ss'),'day') duration
  from  tIf it produces more output than you'll ever need, use SUBSTR (or some similar function) to get only the part you're interested in.

Similar Messages

  • Converting CLLocation to a human-readable place name string

    In a text-based application I want to enable a simple geotagging feature. Is there a way to convert a CLLocation latitude-longitude information into an actual place name, like "New York, NY", "Vancouver, B.C., Canada", "Birmingham, England" etc.? It doesn't need to be terribly precise, if it can recognize all towns/cities of more than 100-200K people I will be happy. On the same subject, since I'm new to the whole geotagging/GPS thing (I'm developing on a Touch and have never used a GPS device), what are some other developers doing with regards to presenting location information in a human-readable format? Just knowing the longitude/lattitude seems rather uninspiring to me.
    Thanks,
    DonutMan

    You can use Google Maps Reverse Geocoding service.
    http://code.google.com/apis/maps/documentation/services.html#ReverseGeocoding
    It should be easy to wrap these js functions into Objective-C with -stringByEvaluatingJavaScriptFromString:
    I know there is also a pure OBJC Google API framework but I don't know if it includes this.

  • Time difference by date by time range - a better way?

    Someone suggested this is a better place for my question:
    Hi
    I need to display the difference in time - every day for different time ranges,
    Example 1-2 pm, 4-5 pm, 7-8 pm. And I need the time difference in 2 dates in the past week for each of these ranges everyday.
    example
    Date Diff Range
    01/01/2007 00:01 1-2pm
    01/02/2007 00:03
    01/03/2007 00:10
    01/04/2007 00:05
    01/05/2007 00:23
    01/01/2007 00:10 4-5pm
    01/02/2007 00:13
    01/03/2007 00:11
    01/04/2007 00:15
    01/05/2007 00:23
    01/01/2007 01:10 7-8pm
    01/02/2007 00:13
    01/03/2007 00:10
    01/04/2007 00:11
    01/05/2007 00:21
    One way to achieve this is to have multiple unions for each day and each time range.
    Example:
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    union
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    union
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    This will give me the required information for only one day - and that is for sysdate-5.
    I will have same nyumber of unions for each day.
    Is there a better way to accomplish the same?
    Any help appreciated.
    Thx!

    Hi
    Sorry for the late response but better late than never:::
    I have gotten the answer of getting data for previous 5 days. I have changed the time between statement and is given below(*).
    Here is a reply to all the questions you had asked in response to my questions.
    What data you have? What parameters are you going to input?
    I have already given sample data in my post.
    There are no input parameters.
    You are talking about the difference - between what is this difference?
    Difference is the difference between 2 timestamp datatypes in 2 different tables (as you may see in the query)
    The field diff - is it varchar2 like '1-2 pm' or what?
    I didnt understand your question. What do you get when you subtract two timestamp datatypes - that should be the datatype - if I have understood your question. Not sure if thats what you asked.
    But IMHO it's impossible to get such a result, of course, if dt_tm in the query is the same as Date in the result!
    The time components in the queries are different. If you see:
    1st Query:...
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    2nd Query:....
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    3rd Query:
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    First should be between 1 and 2 pm for sysdate-5.
    I need starting previous 5 days till sysdate.
    Second is between 4 and 5 pm again for sysdate-5.
    I need starting previous 5 days till sysdate.
    Same with 3rd.
    My final query is something like this:
    select t1.dt_tm, count(t1.id), '1 - 3 am' as period
    from table1 t1, table2 t2
    where t1.id = t2.id
    and dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    group by t1.dt_tm
    union
    select t1.dt_tm, count(t1.id), '4 - 5 pm' as period
    from table1 t1, table2 t2
    where t1.id = t2.id
    and dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    group by t1.dt_tm
    union
    select t1.dt_tm, count(t1.id), '7 -8 pm' as period
    from table1 t1, table2 t2
    where t1.id = t2.id
    and dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    group by t1.dt_tm
    I need for the last 5 days and what i can think of is have 5 different queries for past 5 days and 3 queries per day for the 3 different time periods. This would mean 15 queries. Was wondering if there is a better way to achieve the same?
    Any help appreciated.
    Thx!

  • How to convert termianl log to human readable log in ADF mobile

    When I debug my ADF mobile application, I write command tail -f /var/log/system.log in terminal. And I get following output.
    May 6 11:32:42 evosys-iMacs-iMac.local manager[507]: Obj-C [CH-1, State=created ableToSend=Yes]: Message arrived - VMMessage [
         type: Plain[0x00]
         prinorty: 2
         channelID: -1
         messageID: 3
         length: 137
         body: {41, 44, 46, 4D, 53, 47, 20, 31, 30, 30, 30, 30, 20, 20, 20, 35, 31, 31, 20, 20, 20, 35, 31, 31, 20, 20, 20, 20, 20, 30, 20, 20, 20, 31, 30, 31, 7B, 22, 72, 65, 73, 75, 6C, 74, 22, 3A, 5B, 5D, 2C, 22, 64, 61, 74, 61, 43, 68, 61, 6E, 67, 65, 45, 76, 65, 6E, 74, 22, 3A, 7B, 22, 76, 61, 72, 69, 61, 62, 6C, 65, 43, 68, 61, 6E, 67, 65, 73, 22, 3A, 7B, 22, 76, 69, 65, 77, 53, 63, 6F, 70, 65, 22, 3A, 7B, 22, 2E, 6E, 75, 6C, 6C, 22, 3A, 74, 72, 75, 65, 7D, 7D, 2C, 22, 70, 72, 6F, 76, 69, 64, 65, 72, 43, 68, 61, 6E, 67, 65, 73, 22, 3A, 7B, 7D, 7D, 7D}
    But I have no idea that how to convert body into string,
    Thanks in Advance.

    Dennis Knutson wrote:
    Are you refering to the front panel logging option? The actual binary format is going to depend on what controls and indicators you have on the front panel and their data types. There is an example of using the file i/o functions to read one of these files in chapter 14 of the user manual. The problem you'll have if you write a program to read a log file is that every time you add or delete a control/indicator, you'll have to rewrite your program and then you'll be unable to read older log files. You'd be better off writing your own log routines. Then you would control the binary format. There are shipping examples that you can look at for fbinary file storage.
    Yes, I am referring the front panel logging option and I will read the maual first. Thank you very much for your help.

  • DateDiff Help (Need time difference FROM Time 1 TO Time 2 - one direction)

    I hope I am putting this in the right section. This is my first post. Thank you all ahead of time for your help.
    I am new to both SQL and Report Builder so please bear with me and thank you ahead of time.
    I need to find the time difference (in minutes) between Time 1 and Time 2. I've figured out the basics in how to do this but I need the logic to work in ONE DIRECTION. Meaning I need the statement to find the difference STARTING FROM TIME 1 and then ENDING
    WITH TIME 2. I need the statement to always assume that Time 1 is FIRST and that Time 2 is LAST.
    Here's an example of my results now with a basic DateDiff statement.
    Time 1 | Time 2 | Time Difference (in minutes)
    11:30 | 1/15/2015 11:50:00 AM | 20
    23:50 | 1/15/2015 12:00:00 AM | 1430
    23:45 | 1/15/2014 2:05:00 AM | 1300
    Please note that Time 1 does NOT have a date at all and came over from its table as a simple 4 digit string so I had to convert it to datetime format using a concatenate statement. If it DID have a date then this probably wouldn't be a problem.
    Thoughts?
    Thanks.

    Thanks, Patrick. I'll look into understanding that (I'm still new to both SQL and Report Builder). Could you explain to me what it does?
    I was able to answer my own question only to find that it didn't quite work the way I need it to. I was able to make the logic work so that "if the time is 12AM then change the date for Time 1". However, I ran into another problem and realize that
    I ultimately just need to get this to work in one direction. Meaning I need it to find the difference in time STARTING from the Time 1 field TO the Time 2 field. Here's why (using the statement I got to work but only for 12AM):
    Time 1 | Time 2 | Time Difference (in minutes)
    23:45 | 1/15/2014 2:05:00 AM | -1300

  • FM to find time difference

    Hi Experts,
    Is there any function module to find time difference between two given time.
    Thanks
    RR

    try using this 1.
    SD_CALC_DURATION_FROM_DATETIME

  • Time difference issue - need a better way

    Hi
    I need to display the difference in time - every day for different time ranges,
    Example 1-2 pm, 4-5 pm, 7-8 pm. And I need the time difference in 2 dates in the past week for each of these ranges everyday.
    example
    Date Diff Range
    01/01/2007 00:01 1-2pm
    01/02/2007 00:03
    01/03/2007 00:10
    01/04/2007 00:05
    01/05/2007 00:23
    01/01/2007 00:10 4-5pm
    01/02/2007 00:13
    01/03/2007 00:11
    01/04/2007 00:15
    01/05/2007 00:23
    01/01/2007 01:10 7-8pm
    01/02/2007 00:13
    01/03/2007 00:10
    01/04/2007 00:11
    01/05/2007 00:21
    One way to achieve this is to have multiple unions for each day and each time range.
    Example:
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 13:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 14:00','mm/dd/yyyy hh24:mi:ss')
    union
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 16:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 17:00','mm/dd/yyyy hh24:mi:ss')
    union
    select
    from
    where dt_tm between
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 19:00','mm/dd/yyyy hh24:mi:ss')and
    to_date(to_char((sysdate-5),'mm/dd/yyyy')||' 20:00','mm/dd/yyyy hh24:mi:ss')
    This will give me the required information for only one day - and that is for sysdate-5.
    I will have same nyumber of unions for each day.
    Is there a better way to accomplish the same?
    Any help appreciated.
    Thx!

    Time difference by date by time range - a better way?

  • Analyzing data for max peak time differences after sampling

    In the VI attached, each channel is measuring a certain moment of
    acceleration, which will be displayed as a global max on the graph.
    Ideally what I would like to happen is for
    both arrays to be searched for their highest peak (global max) and for
    the time difference between these two peaks to be shown on the display
    after the program has ended. However, what I have right now is a
    sort-of real time measurement. Any suggestions on going about doing this?
    Thanks,
    John
    Solved!
    Go to Solution.
    Attachments:
    TimePeakTest-cp-2.vi ‏74 KB

    Thanks for your help Stephen!
    I've made those changes, but after the highest peak from each channel occurs, the time difference indicator shows the time diff. between the two peaks only for a split second, and then the indicator returns back to zero. I would like for this max peak-max peak time difference to somehow remain on the indicator after the program has stopped running, because its value, whether it is below or above a certain constant, will need to indicate a true/false statement.
    Any help is greatly appreciated.
    Thanks,
    John
    Attachments:
    TimePeakTest-cp-2.vi ‏74 KB

  • Unix timestamp conversion to human readable representation ...

    Hi,
    I map unix timestamps from MaxDB to the controller context of Web Dynpro and display the results in a table. Is there a smart way to convert the timestamps to human readable date and time? Maybe some way to manipulate the table values with a function before they are written ..?
    For now, I create a new node in the context and manually set each value with the according date/time representation ... but thats pretty cumbersome.
    Thank you very much for your help!
    Cheers,
    boris

    Hi Boris,
    Check http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
    Date currentTime_1 = new Date(longUnixTimestamp);
    String dateString = formatter.format(currentTime_1);
    I would suggest you to create a calculated attribute under the same node as initial timestamp value and return a result of SimpleDateFormat.format().
    Best regards, Maksim Rashchynski.

  • Convert unix time stamp to readable time with daylight saving

    Hello NG,
    I have a table that has a column containing time stamps in the unix time format (seconds since 1970). If I show these times to the user, they should be converted to some readable format. I'm using the following sql code as an example:
    select to_char(
    to_timestamp_tz(
    to_char(
    to_date('01011970','ddmmyyyy') + 1/24/60/60 * 1086508800,
    'YYYY-MM-DD HH24:MI:SS')||' Europe/Warsaw',
    'YYYY-MM-DD HH24:MI:SS TZR'),
    'YYYY-MM-DD HH24:MI:SS TZH:TZM')
    from dual;
    The output I get is the following:
    TO_CHAR(TO_TIMESTAMP_TZ(TO
    2004-06-06 08:00:00 +02:00
    The output is right, but the format I need is the following:
    2004-06-06 10:00:00
    How do I have to alter the statement to get the correct result (add the two hours of the timezone and dst to the time)?
    Any help is appreciated.
    Regards,
    Mario Freimann

    That's the strange thin ... this timezone doesn't exist.
    Running the query I get the error message
    ORA-01882: timezone-region not found
    The results of the statement
    select * from V$TIMEZONE_NAMES;
    for Europe are:
    TZNAME TZABBREV
    Europe/Dublin LMT
    Europe/Dublin DMT
    Europe/Dublin IST
    Europe/Dublin GMT
    Europe/Dublin BST
    Europe/Istanbul LMT
    Europe/Istanbul IMT
    Europe/Istanbul EET
    Europe/Istanbul EEST
    Europe/Istanbul TRST
    Europe/Istanbul TRT
    Europe/Lisbon LMT
    Europe/Lisbon WET
    Europe/Lisbon WEST
    Europe/Lisbon WEMT
    Europe/Lisbon CET
    Europe/Lisbon CEST
    Europe/London LMT
    Europe/London GMT
    Europe/London BST
    Europe/London BDST
    Europe/Moscow LMT
    Europe/Moscow MMT
    Europe/Moscow MST
    Europe/Moscow MDST
    Europe/Moscow S
    Europe/Moscow MSD
    Europe/Moscow MSK
    Europe/Moscow EET
    Europe/Moscow EEST
    Europe/Warsaw LMT
    Europe/Warsaw WMT
    Europe/Warsaw CET
    Europe/Warsaw CEST
    Europe/Warsaw EET
    Possibly something is not right with my installation (Oracle 9.2.0.1.0) ...

  • Convert from epoch timestamp to human readable date

    Hi everybody,
         I want to retrieve a human readable date from an fpga target of a sbRIO9636 ,so what is the function which can convert an epoch timestamp to a human readable date ? 
    (Noting that i need to retrieve the second,minute,hour,day,month,year... from the fpga target of this device)
    Thanks

    I have a program which retrieve the current time of windows (with the Get Date/Time in Seconds and Seconds to Date/time functions) and calculate the julian day parameter by using the second,minute,hour,day,month and year wich are displayed on the elements of the Unbundle By Name function (connected in the output of Seconds to Date/time function).
    This program works within windows and real time but I can't run it in the chassis of the sbRIO (errors displayed that these functions above aren't supported in the current target)
    Can i use another method to solve this problem.
    (See the front panel of this program in the following attached file)
    Attachments:
    julian day.PNG ‏110 KB

  • Calculate time difference in Labview from excel file

    I am reading in values from a excel files, the file contains date and time data in one cell, then either an On or Off value in the cell next to it. I would like to find the time difference between the on and the off cycles. The VI I have so far brings in the Excel file but I don't know how to subtract the dates. Any help would be appreciated. I have attached the vi and hopefully I can attach and example excel file.
    Attachments:
    Hobo Import.vi ‏156 KB

    Hi Bryan!
    I made a small VI (in LabVIEW 7.1) that converts to strings (of your format) to timestamp datatype and then subtracts them resulting in a difference measured in seconds. There might be a more optimal way to do this in your application, but I thought I'd at least try to contribute. Also, notice that there is a Y3K bug in there :-)
    Hope this helps!
    Travis H.
    National Instruments
    Travis H.
    LabVIEW R&D
    National Instruments
    Attachments:
    FormattoTimeStamp.vi ‏38 KB

  • How to write a query to get the time difference of two varchar type time columns

    Hi,
    I want to get the time difference between the two varchar type columns.please see the attached image for more details:
    My requirement is like:
    timestarted
    timeended
    timediff
    9:00:00
    10:00:00
    1:00
    9:15
    9:30:00
    0:15

    Storing time alone as VARCHAR2 value is a incorrect design. Always store it as DATE or TIMESTAMP.
    If you already have a messed up design and cant change it, then you need to convert your VARCHAR2 time into a DATE or TIMESTAMP and find the difference. I have converted it to TIMESTAMP and obtained the difference as INTERVAL.
    SQL> with t
      2  as
      3  (
      4  select '09:00:00' timestarted, '10:00:00' timeended from dual
      5  union all
      6  select '09:15:00' timestarted, '09:30:00' timeended from dual
      7  )
      8  select timestarted
      9       , timeended
    10       , (timeended - timestarted) day to second diff
    11    from (
    12          select to_timestamp('01011900' || timeended, 'ddmmyyyyhh24:mi:ss') timeended
    13               , to_timestamp('01011900' || timestarted, 'ddmmyyyyhh24:mi:ss') timestarted
    14            from t
    15         );
    TIMESTARTED                                        TIMEENDED                                          DIFF
    01-JAN-00 09.00.00.000000000 AM                    01-JAN-00 10.00.00.000000000 AM                    +00 01:00:00.000000
    01-JAN-00 09.15.00.000000000 AM                    01-JAN-00 09.30.00.000000000 AM                    +00 00:15:00.000000
    SQL>

  • Time Difference Calculation Using Shared Variables

    I have a subreport that is passing times(HH:MM:SS AM) through shared TIMEVAR variables to a main report.  I am trying to use these shared variables to calculate a time difference between the shared variable and one in the main report.  The shared variable passes without problems and I end up with a numeric value when trying to subract the two time fields.  What am I doing wrong?

    Here is an example for converting seconds to hh:mm:ss  ( Hopefully the message will not lose the (Parens))
    WhilePrintingRecords;
    StringVar Hours1;
    StringVar Minutes1;
    StringVar Seconds1;
    NumberVar MY_SECONDS_1:=0;
    MY_SECONDS_1:= ;
    If MY_SECONDS_1 < 0 Then
      "Cannot have a time less than zero"
    Else
      (Hours1:=ToText(Truncate(MY_SECONDS_1/3600),0);
      Minutes1:=ToText(Truncate(Remainder(MY_SECONDS_1,3600)/60),0);
      Seconds1:=ToText(Remainder(Remainder(MY_SECONDS_1,3600),60),0));
    Display the time formated.
      (if length(Hours1) < 2 then '0') + Hours1 + ":" +
      ["0",""][length(Minutes1)] + Minutes1 + ":" +
      ["0",""][length(Seconds1)] + Seconds1;

  • SAP BI Date and Time Difference calculations in DSO Transformation

    Hello Guys,
    Could you please tell me how to calculate the date and Time difference between 2 fields.
    I have 2 date fields :
    Arrival Date : 6/16/2007
    Departure date : 6/19/2007
    Also i have 2 time fields for the above
    Arrival Time : 13:00:00
    Departure Time : 11:50:00
    I want to display all the four fields and 2 fields for the difference in Date and Time.
    Is it better to calcuate the differences in DSO Transformation or can you do it in the report itself.Could you please let me know the solution.
    Thanks,
    BI Consultant

    Hello Consulant BI,
    Computing the difference of two dates is easy (assuming you really just want the number of days). You can simply subtract the two dates using ABAP:
    data: w_arrival_date type sy-datum,
            w_dep_date type sy-datum,
            w_diff type i.
    w_arrival_date = <your arrival date field here>.
    w_arrival_date = <your departure field here>.
    w_diff  = w_arrival_date - w_dep_date.
    Getting the time difference isn't really much logical. I think what you want instead is to compute the totals days (and extra hours) right? If this is the case, then you can convert the date+time for both the arrival and departure  into a timestamp variable first and then t the get difference.
    Hope this helps.

Maybe you are looking for

  • Report structure issue

    EPM 10 SP15 I have a requirement to build a asymmetric column axis and dynamic row expansion input form to be done. If i can do this, that would avoid unnecessary building the same structure with 7 different reports to construct the asymmetric column

  • Error Code 0x80070035 - The network path was not found, Windows Server 2008 SP2

    I have bee receiving following "error code 0x80070035 - The network path was not found" when trying to open file shares in both directions using Windows Server 2008 Standard SP2 at both ends. The issue is identical to the KB article KB958285, however

  • Different parameters for different sheets- Command Line Script

    Hi, I am using command line script to run my discoverer report. I have 5 sheets in the workbook out of which, 2 has a PeriodID parameter, and the other 3 sheets does not have parameters. Is it possible to execute this scenario. This is the script i u

  • 1131 LWAP not join WLC 4402

    I am deploying WLC 4402 with LWAP 1131 but AP fail to join the WLC .The resone that I dont have DNS server.The error message in the AP is : AP001d.451f.8582> *Mar 1 00:00:38.005: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0 assigned D HCP address

  • DB2 : data compression active ?

    Hi forum, how can I find out whether data compression is active in our DB2 database with SAP BW ? Kind regards S0007336574