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

Similar Messages

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

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

  • 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")

  • Unix timestamp in cfgrid

    Sometime ago I produced a php and SQL jobsite. Users apply
    for jobs and the date they apply is converted into a unix timestamp
    and inserted into the SQL as an integer.
    I am now using coldfusion increasingly more, and am wanting
    to display the results above using a cfgrid.
    Although I have found similar posts in this forum I still
    have two oustanding queries:
    1) How do I catch the date for each row before the cfgrid
    displays it
    2) How to convert unix timestamp using coldfusion

    chilliroom wrote:
    >
    quote:
    format it via the db is probably the cheapest.
    > I am still unsure how to catch the date for each row
    before the cfgrd grabs it.
    what db? does it have this functionality? for sql server
    something like should
    work (but again watch for overflow):
    SELECT
    dateAdd(second,yourUnixEpochOffsetDataColumn,'1-jan-1970') as
    aDate,....
    FROM yourTable
    > How can I extract this value to then feed into
    "yourUnixEpochOffsetData".
    if your db can't handle this, here's one way using cf (but
    the db is cheaper).
    do your normal cfquery then:
    - convert the unix epoch offsets to datetimes:
    unixEpoch=createDate(1970,1,1);
    newDates=arrayNew(1);
    for (i=1; i LTE yourRegularcfQuery.recordCount;i=i+1) {
    newDates
    =dateAdd("s",yourRegularcfQuery.yourUnixEpochOffsetDataColumn,unixEpoch);
    depending on your needs, you might also want to dateFormat
    the results of the
    dataAdd:
    newDates
    =dateFormat(dateAdd("s",yourRegularcfQuery.yourUnixEpochOffsetDataColumn,unixEpoch));
    - add a column to your cfquery & fill with those
    converted dates,
    queryAddColumn(yourRegularcfQuery,"aDate","date",newDates);

  • 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 to LabVIEW time

    Hello
    I need to convert a Unix timestamp comming froma dll to a LabVIEW time. Does anybody now some ready to use function for this?
    Thanks
    Solved!
    Go to Solution.

    DAckermann wrote:
    Oh yes. That was easy.
    Thank you very much!
    Exceot that there is a small possible gotcha. If you enter 1/1/1970 in a LabVIEW timestamp control and convert this to a double to get the number of seconds you likely end up with an error of your local timezone offset.
    Both the Unix and LabVIEW epoch are defined respective to GMT which for most practical purposes is the same as UTC. So you have to make sure to get the number of seconds for a timestamp that shows 1/1/1970 00:00 UTC to be right.
    Spoiler (Highlight to read)
    If you ended up with 2082844800 as offset then you got it right.
    If you ended up with 2082844800 as offset then you got it right.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • 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

  • Unix Timestamp to date

    hi,
    I am using SQL developer to query an oracle 8 Database and
    I need to convert a unix timestamp to a specific date time format - YYYYMMDD HH24:MI:SS
    I am currently using
    ,to_date('19700101 00:00:01','YYYYMMDD HH24:MI:SS')+sh.order_date/86400
    but this just returns the date in the format DD-MMM-YY

    Hi,
    Welcome to the forum!
    What is a unix timestamp?
    If it's the number of seconds since mdinight on January 1, 1970, then you can convert that to a DATE like this:
    DATE '1970-01-01' + ( unix_timestamp
                       / (24 * 60 * 60)
                  )To display any DATE in a specific format, use TO_CHAR:
    TO_CHAR ( DATE '1970-01-01' + ( unix_timestamp
                                  / (24 * 60 * 60)
         , 'YYYYMMDD HH24:MI:SS'
         )

  • UNIX Timestamp

    Hello
    How do I convert UNIX timestamp to Oracle
    Thanks
    Sameer

    hi,
    Write a Shell script which will pass the date to the procedure as a Parameter.
    Example.
    dt=`date`
    echo $dt
    sqlplus /nolog < scott/tiger 2>/dev/null <!EOF
    begin
    convertDate('$dt');
    end;
    !EOFThe Procedure.
    Create Or replace function convertDate(dt in Varchar2) return Date
    As
    convertDt Date;
    Begin
    -- Assuming that the Dt is 'Mon 3 Sep 2001 14:00:45'
    select to_date(dt, 'Dy DD Mon YYYY hh24:MI:SS') into convertDt from dual;
    return convertDt;
    End;Since i dont have a Unix Mac u will have to tweak the Shell Script on the Redirection Symbols.
    Oracle Does not support Timezones ... If u need to Incorportae TZ then pls look into a Java Solutiion.
    Hope this helps.
    Regards,
    Ganesh R

  • Oracle timestamp to unix timestamp

    Hi everyone!
    I need to convert a values fetched from a db table in a unix timestamp (seconds passed by january first 1970).
    The table is like this
    create table test(.... ts timestamp not null...);
    and the code to define the output variable (for a select statement) is the following, where time is an OCIDateTime variable
    OCIDefineByPos(stmth, &defineh, errh, pos, (dvoid *) time, 0, SQLT_ODT,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT);
    once I have initialized "time", how can I convert his content to unix timestamp?
    And viceversa, how can I put an int value rapresenting a unix timestamp in an OCIDateTime variable, and then insert it correctly inside mt table?
    thank you!
    GePs

    I define my buffer according on the the table's field width I retrieve from metadata. In ths way:
    OCIAttrGet((dvoid *) pars, (ub4) OCI_DTYPE_PARAM, (dvoid *) col_width, (ub4 *) 0,
    (ub4) OCI_ATTR_DATA_SIZE, (OCIError *) err);
    Now in col_width there's the dimension of the field (for a timestamp field is 11!). Then I bind the correct variable in the correct manner (with a varchar2 fiedl it works!)
    int pos = 1;
    char *time;
    time = malloc(sizeof(char*));
    OCIDefineByPos(stmt, defs, err, (ub4) pos, time, (sword) col_width+ 1, SQLT_STR, (dvoid *) 0,
                                  (ub2 *)0, (ub2 *)0, OCI_DEFAULT);
    Now if I print time I get the trunked timestamp
    printf("%s", time); //-> 11-NOV-05 1

  • How to get Unix timestamp?

    Hi All,
    Didn't find any solution with a search so asking if somebody's already implemented a method to get a Unix timestamp in BPEL? It's a number of seconds since Jan-1-1970. I'm quite new to BPEL so any help is appreciated!
    Thank you in advance,
    Philipp

    Hi Philipp,
         One approach can be to use Java embedding in BPEL to get Unix timestamp.
    Check this out Java Embedding Activity in BPEL | Oracle SOA Training | BPEL, OSB, BAM, OWSM, B2B |ORACLE FUSION MIDDLEWARE SCHOOL
    Ref: Incorporating Java and Java EE Code in a BPEL Process
    -- Sid

  • Unix timestamp in win95 CVI

    Hi;
    How can I generate a unix timestamp value on a Win9x platform. I looked
    at the time function in CVI and it calculates from Jan 1 1990 and I need
    it form Jan 1 1970.
    Thanks in advance for any help
    J.S.

    John Stanley wrote:
    > Hi;
    > How can I generate a unix timestamp value on a Win9x platform. I looked
    > at the time function in CVI and it calculates from Jan 1 1990 and I need
    > it form Jan 1 1970.
    > Thanks in advance for any help
    > J.S.
    I guess the short answer is to find the time difference between the two.
    I looked in my old "Encyclopedia C" and it says that the time_t is
    elaspsed seconds since 00:00:00 1/1/1970 GMT (for UNIX compatibility)
    Unix base 1970
    DOS base 1980.
    The help window on my CVI (V5.0.1 Solaris) says that the
    function time(), is based on 1900 for MS Win and 1970 for UNIX.
    Now you are saying it is 1990 for Windows ???
    At any rate the elapsed seconds between
    00:00:00 1/1/1970 and 00:00:00 1/1/1990 (both GMT)
    seems to be 631,152,000
    20 years * 365 days = 7300 days
    + 5 days for '72, '76, '80, '84, '88 (leap years)
    = 7305 days
    * 86400 (sec /day) =
    631,152,000 seconds difference ]
    If that is any help
    Kevin Kent

Maybe you are looking for