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.

Similar Messages

  • 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

  • Unix timestamp / epoch conversion in IQ

    Hello,
    I searched the community as well as some other historical locations, but couldn't find any discussions on this.
    In several of the projects I am working with, there is a source datetime field that always comes in as a unix timestamp (i.e. seconds since the epoch). The question I regularly get is, can we load this into IQ and have it converted during load from the integer into an IQ datetime column.
    I have my own suggestions for how to solve this already, but rather than influence the creative (or resolute) mind, I thought I'd put it out to the community to see how you have/would solve this issue?
    Thoughts??
    Thank you,
    -Joe Love
    SAP Mobile Services and Consumer Insights

    None that I am aware of during the LOAD TABLE event.  You can always load it and post process the data, but that's gets ugly and requires you to carry an extra column in your table.  My typical approach is to have the data converted before loading into IQ.  If the data is being touched by a streaming engine, ETL tool, or replication, you can do it all inline with those tools and a little coding.  For 3rd party tools, I would have them change their code to generate readable date/time stamps.  That or pre-process the data with something like sed or awk.
    Mark

  • How can i convert the firefox-history-timestamp in places.sqlite into a normal date format? The firefox-timestamp is not equivalent to the unix-timestamp, that's why I ask. I could not find a conversion function. Does anyone know something about this?

    As I opened the places.sqlite with an sqlite-editor I found out that firefox saves the last_visit_date via a timestamp which is 16 digits long. I realized that the first 10 digits are similar to the corresponding unix-timestamp but not equal. So.. how can i convert the firefox-timestamp into a normal date? Or into the corresponding unix-timestamp?

    Write a bash script or 'C' program to change the date format and then use the sql update function to receive the stdio output 'where date_field='embeded date value'.

  • Unix timestamp to Oracle timestamp conversion

    Hi all,
    I am trying to convert the UNIX timestamp to ORACLE timestamp .
    I have done like this upto now.
    CREATE OR REPLCACE FUNCTION unixts_to_oraclets(unixtimestamp IN INTEGER)
    RETURN DATE IS
    result DATE;
    BEGIN
    result := TO_DATE('1970-01-01', 'YYYY-MM-DD') + numtodsinterval(unixtimestamp, 'SECOND');
    return(result);
    end unixts_to_oraclets;
    now i have run this query
    SQL> select unixts_to_oraclets(1139291114) as TS from dual;
    TS
    07-FEB-06
    now i need the ouput to like this 07-FEB-06 01:10:12
    for that i have done like this:
    DECLARE
    v_date DATE;
    res_date DATE;
    BEGIN
    SELECT from_uts(1139291114)INTO v_date FROM dual;
    SELECT TO_TIMESTAMP(v_date,'DD-MON-RRHH24.MI.SS.FF') INTO res_date FROM dual;
    DBMS_OUTPUT.PUT_LINE(res_date);
    END;
    but the output is :
    SQL> /
    07-FEB-06
    PL/SQL procedure successfully completed.
    why is that it is not printing 07-FEB-06 01:10:12 ?
    how should i moodify the code to get the desired output.
    please help me i this regard
    Trinath Somanchi,
    Hyderabad.

    SQL> exec dbms_output.put_line(sysdate);
    07-FEB-06
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line(to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS'));
    07-02-2006 02:48:35
    PL/SQL procedure successfully completed.
    SQL> alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS';
    Session altered.
    SQL> exec dbms_output.put_line(sysdate);
    07-02-2006 02:49:03
    PL/SQL procedure successfully completed.

  • Unix Timestamp & Formula

    Post Author: eskimo42
    CA Forum: Formula
    I have an ecommerce DB which I am trying to report on using Crystal
    Reports 2008. Please bear with me, this is my first time using Crystal
    Reports. Here is my issue: The
    order creation date field in the eCommerce DB is being pulled as a Unix
    Timestamp. After some research online I have found that this formula
    should help me convert the timestamps into a readable format:DateAdd (u201Dsu201D,{jos_vm_orders1.cdate}-18000, #1/1/1970#)So
    I have created numerous formula fields, Formatting Formulas, Custom
    Functions, and all I can seem to come up with is this error:The ) is missing. I
    really hope someone can walk me through how exactly I can convert a DB
    field which appears in a report to, a readable time stamp with that
    formula I have above. Thanks,Evan

    Post Author: bettername
    CA Forum: Formula
    Glad that worked!
    Since Crystal doesn't support UnixTimeStamp<->DateTime conversion (c'mon guys!), you're going to have to write a formula for each field that you want to display that uses a Timestamp field (boring, yes!), and drag each of the formulas onto the page.  I sure hope I'm missing something there...
    You could create a custom function to save some typing - have a look at http://publib.boulder.ibm.com/infocenter/radhelp/v6r0m1/index.jsp?topic=/com.businessobjects.integration.eclipse.doc.crdesigner/reportdesigner/crconcustomfunctions.htm, but essentially the code is:
    Function (numbervar UnixTimeStamp)DateAdd ("s",UnixTimeStamp-18000, date(1970,01,01))
    That way, each time you want to convert a field, you just type a formula that says "UnixToDateTime ({yourTable.YourField})"
    I think you know where to create a formula (View - Field Explorer).  Once you've created the formula, drop it in the details section, then goto 'Insert' - 'Group', choose the formula and the rest should be obvious...

  • Convert UNIX timestamp in a report in Report Builder

    Hi,
    I have a column with unix timestamp (i.e 1386782654 ).
    How can I make that conversion to a dateformat  like 2013-03-05 17:32 ?
    I have tried =DateAdd("s", Fields!timestamp.Value, "19700101 00:00:00:000") but it just gives me an error.
    Anyone knows how to get this right?

    I solved it myself,
    The correct expression is: =DateAdd("s", Fields!timestamp.Value,"1970-01-01 00:00:00")

  • NW RFC SDK: No more human-readable RFC error messages?

    I'm converting my program from the classic RFC SDK to the NetWeaver one.
    Apparently, the RFC_ERROR_INFO.message value is no longer filled with the proper human-readable error message as it used to be.
    Eaxmple: trying to create a function description for a non-existant function
    Classic SDK: "Function module "Z_MYFUNC" not found."
    NetWeaver SDK: "ID:FL Type:E Number:046 Z_MYFUNC"
    I don't see how to get the old message back. Can anyone help? Thanks!

    I am using nwrfcsdk in c directly, I have encountered some other issues, you may
    check the nwrfcsdk init release blog by Ulrich via
    /people/ulrich.schmidt/blog/2007/05/10/sap-netweaver-rfc-sdk
    May be the patch 1 have solved this issue already.
    sapnote 1056472 SAP NW RFC SDK 7.10 -- Patch level 1

  • Timestamp conversion problem.

    I work in the development of a LabVIEW program that communicates with a
    server (written in Java). All acquired data is sent via TCP and the
    server can read everything (waveforms and other information). However,
    there is a problem in timestamp conversion. We don't know how to
    convert the milliseconds correctly. The timestamp is inside a waveform,
    so we cannot convert it to formatted string.
    Example:
    Original timestamp:
    13:37:19,639
    11/10/2005
    String generated with "Flatten to String":
    0000 0000 BF71 9ABF A3D7 0800 0000 0000
    Converted value (Java server):
    13:37:19,000
    11/10/2005
    Does anyone know the algorithm to obtain the milliseconds from this value: "A3D7 0800"?
    Thanks for attention.
    My regards,
    Vinicius Falseth
    Solved!
    Go to Solution.

    There is a faster way.  You can extract the timestamp from the waveform using Get Waveform Components. 
    At that point, you can convert it to whatever you want.  Attached
    is a VI which shows a simple conversion to milliseconds, losing a lot
    of resolution (128 bit timestamp goes to 52 bit double) and a more
    complex conversion showing the internal structure of the timestamp (it
    is a 128 bit fixed point number with the decimal in the middle). 
    You can modify the second conversion to do such things as throw away
    the integer portion to get higher resolution on the fraction.  Or
    you could just save to Java using a four-integer structure.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    timestamp.llb ‏48 KB

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

  • Transform XML-String to human readable XML-File

    I need to transform a XML-String as coming from a simple transformation into a human readable XML-File. That means with linebreaks and logical indenting, each line not longer than n charactors.
    Example:
    <one><two>text</two><three><four>text</four></three></one>
    into
    <one>
      <two>text</two>
      <three>
        <four>text</four>
      </three>
    </one>

    I wrote a method that will do this, but the method can not handle all kinds of XML-strings, but it works with most simple XML-Strings:
    METHOD xml_str2table.
    *** Importing
    **    I_XMLSTRING type csequence
    *** Returning
    ***   e_tab_XMLtab type table of string.        
      DATA l_cnt_length TYPE i.
      l_cnt_length = STRLEN( i_xmlstring ).
      DATA l_cnt_index TYPE i.
      DATA l_xmlline TYPE string.
      DATA l_oldchar TYPE c.
      DATA l_char TYPE c.
      DATA l_nextchar TYPE c.
      DATA l_indent TYPE i.
      DO l_cnt_length TIMES.
        l_cnt_index = sy-index - 1.
        l_char = i_xmlstring+l_cnt_index(1).
        IF sy-index < l_cnt_length.
          l_nextchar = i_xmlstring+sy-index(1).
        ENDIF.
        IF  l_char <> cl_abap_char_utilities=>newline.
          IF ( l_char = '<' AND l_nextchar = '/' ) OR
             ( l_char = '/' AND l_nextchar = '>' ).
            l_indent = l_indent - 1.
            IF l_indent < 0.
              l_indent = 0.
            ENDIF.
          ENDIF.
          IF l_char = '<' AND l_oldchar = '>'.
            APPEND l_xmlline TO e_tab_xmltab.
    *      write: / l_xmlline.
            CLEAR l_xmlline.
            DO l_indent TIMES.
              CONCATENATE space space l_xmlline INTO l_xmlline SEPARATED BY space.
            ENDDO.
          ENDIF.
          if l_char <> space.
            CONCATENATE l_xmlline l_char INTO l_xmlline.
          else.
            CONCATENATE l_xmlline l_char INTO l_xmlline SEPARATED BY space.
          endif.
          IF l_char = '<' AND l_nextchar <> '/'.
            l_indent = l_indent + 1.
          ENDIF.
        ELSE.
          l_indent = 0.
          APPEND l_xmlline TO e_tab_xmltab.
    *    write: / l_xmlline.
          CLEAR l_xmlline.
        ENDIF.
        l_oldchar = l_char.
      ENDDO.
      APPEND l_xmlline TO e_tab_xmltab.
    *write: / l_xmlline.
    ENDMETHOD.
    The second Method does the same not with an string, but with an X-String:
    METHOD xml_xstr2table.
    *** Importing
    **    I_XMLSTRING type xsequence
    *** Returning
    ***   e_tab_XMLtab type table of string.     
      DATA l_tmp_string TYPE string.
      DATA conv TYPE REF TO cl_abap_conv_in_ce.
      conv = cl_abap_conv_in_ce=>create(
                encoding = 'UTF-8'
                endian = 'L' ).
      conv->convert(
        EXPORTING input = i_xmlstring
        IMPORTING data = l_tmp_string ).
      e_tab_xmltab = xml_str2table( l_tmp_string ).
    ENDMETHOD.

  • Getting a date as a unix timestamp

    Hello everyone,
    is the long that is returned by the getTime() method in the date class supposed to be the same as a unix timestamp?
    Below I have a time from yesterday, but when i compare this with System.currentTimeMillis(), the currentTime has a smaller timestamp
    code]SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-kk:mm:ss");
              long expiryDate=0;
              try{
                   Date d = sdf.parse("11-11-2006-19:07:50");
                   expiryDate = d.getTime(); results in 1163358470000
              catch(ParseException pe){
                   pe.printStackTrace();
    yesterdays time is 1163358470000
    current time is 1163355193562 // smaller number
    Whats going on?

    sorry, here it is again
    is the long that is returned by the getTime() method in the date class supposed to be the same as a unix timestamp?
    Below I have a time from yesterday, but when i compare this with System.currentTimeMillis(), the currentTime has a smaller timestamp
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-kk:mm:ss");
    long expiryDate=0;
    try{
    Date d = sdf.parse("11-11-2006-19:07:50");
    expiryDate = d.getTime(); results in 1163358470000
    catch(ParseException pe){
    pe.printStackTrace();
    }yesterdays time is 1163358470000
    current time is 1163355193562 // smaller number
    Whats going on?

  • Select entries between two dates by converting Unix timestamp in Oracle Dat

    Hi,
    I need to select the entries between two dates from an Oracle db. The Oracle db has a column with Unix timestamps. I use the following querry, but it doesnt seem to be working as desired.
    select count(*) from reporter_status where to_char(FIRSTOCCURRENCE, 'mm-dd-yy') between ('08-07-06') and ('08-08-06');
    FIRSTOCCURRENCE has the Unix timestamps.
    Could anyone help me out with this. Thank you for your help.

    Assuming that it is actually a UNIX timestamp, then it is the number of seconds since Jan 1, 1970, so you need something like:
    SELECT COUNT(*)
    FROM reporter_status
    WHERE TO_DATE('01-Jan-1970', 'dd-mon-yyyy') + (firstoccurrence/24/60/60)
                    BETWEEN TO_DATE('08-07-2006', 'mm-dd-yyyy') AND
                            TO_DATE('08-08-2006, 'mm-dd-yyyy');Did Y2K not teach us anything? Use 4 digit years.
    John

  • File which is not human readable

    Dear Friends,
    I want to print some confidential characters and numbers in a file so that,
    1. file will not be editable by any text editor such MS-DOS editor, Notepad or Wordpad etc..
    2. file will not contain human readable characters
    What file writer or reader classes shall I use ? and with what methods ?
    Avijit

    Use ObjectOutputStream...
    from the java doc..
    FileOutputStream ostream = new FileOutputStream("t.tmp");
         ObjectOutputStream p = new ObjectOutputStream(ostream);
         p.writeInt(12345);
         p.writeObject("Today");
         p.writeObject(new Date());
         p.flush();
         ostream.close();You can also encrypt the valuse before writing...
    appu

  • Help to create Materialized View that has timestamp conversion

    I need help creating materialized view with timestamp conversion between GMT to LocalTime.
    Feel free to make any comments.
    Thanks in advance.
    jon joaquino;)

    Here is one way.
    1. Alter the table hist_table and add a new column pdt_timestamp.
    2. Update the new column using the function 'new_time'
    For example,
    Update hist_table
    set pdt_timestamp = new_time(gmt_timestamp,'GMT','PDT');
    3. create a materialized view log on the table 'hist_table' using the syntax
    create materialized view log on hist_table
    with primary key, rowid, sequence;
    4. create a materialized view now using the syntax:
    (You have to specify your own storage numbers and tablespace name)
    create materialized view mview_hist_table
    pctfree 0 tablespace mymview
    storage (initial 16k next 16k pctincrease 0)
    build immediate
    refresh fast on commit
    as select uid,gmt_timestamp,pdt_timestamp
    from hist_table;
    Please test on your test instance before doing it on production. I have tested this on Oracle 10g for Windows 2000. I assumed that column 'uid' is the primary key on the table. I hope this helps.
    **********************************************************

Maybe you are looking for