Conversion of MilliSeconds to Timestamp

Hi,
I'm using Oracle 10g. I want to convert a millisecond value to its corresponding Timestamp. For a millisecond value of 1093853934771 I get the corresponding unix timestamp as 2004-08-30 04:18:54 in mysql using the function FROM_UNIXTIME.
I tried the following in oracle: Adding the milliseconds to the epoch value of 1970-01-01 00:00:00. But got an error.
SQL> select to_timestamp('1970-01-01 00:00:00', 'yyyy-dd-mm hh24:mi:ss') - (1093853934771/1000) SECONDS from dual;
select to_timestamp('1970-01-01 00:00:00', 'yyyy-dd-mm hh24:mi:ss') - (1093853934771/1000) SECONDS from dual
ERROR at line 1:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
Can anyone tell me how to solve this? How will I get the same value of timestamp in Oracle also?

select to_timestamp('1970-01-01 00:00:00', 'yyyy-dd-mm hh24:mi:ss') + (1093853934771/1000/86400) from dual;
TO_TIMESTAMP('19
30.08.2004 08:18would give you a date. you will also have some timezone error here.
let's try to work efficiently with timestamps !
SQL> select ( timestamp '1970-01-01 00:00:00.000 UTC' + numtodsinterval(1093853934771/1000,'SECOND') ) at time zone 'EST' from dual;
(TIMESTAMP'1970-01-0100:00:00.000UTC'+NUMTODSINTERVAL(1093853934771/1000,'S
30-AUG-2004 04:18:54.771000000 EST

Similar Messages

  • Conversion from milliseconds to Date in 1.5

    A java.util.Date object can be constructed by passing the number of milliseconds since 1 January 1970 as a constructor argument. This Date can then be formatted to a human-readable format with SimpleDateFormat.
    I have tested this conversion from milliseconds to a date both in Java SDK 1.4.1 and Java 1.5.0 to see if there are differences in the way dates are calculated from milliseconds. It seems that there are differences when the system timezone is set to Europe/Berlin. The dates from 1.5.0 are one hour ahead of those from 1.4.1 in a certain week in May 1945 and a day in September 1945.
    This means that milliseconds that are generated from a date by using the Java 1.4.1 runtime and then stored are interpreted differently when they are retrieved when using java runtime 1.5.0, if they happen to be one of those days in 1945. This could cause discrepancies when an application is migrated to JDK 1.5.0.
    This is only a minor problem, but is there any way to know what caused these changes in SDK 1.5.0 and what these changes are? Is there historical data that the Sun implementation is based on to calculate dates from millisecond values?
    Any help is appreciated.
    Kind regards

    I found the following at "http://thedailywtf.com/forums/70146/ShowPost.aspx"
    In summer 1945, Berlin and the Soviet-occupied part of Germany observed a daylight savings time of two hours. Unfortunately, Sun's JRE 1.4 implementation of GregorianCalendar defines a maximum DST of one hour and, in non-lenient mode, rejects the 2 hours as invalid when recalculating all fields after the millisecond field is set.
    Here's the bug report: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4639407

  • 10g Oracle Timestamp conversion to milliseconds

    Hello!
    I'm sure this is possible and I have found a couple of references but none that work.
    How can I take an Oracle Timestamp and convert it using a SELECT statement into milliseconds?
    Thanks in advance

    It looked interesting but I don't think it is the answer.
    Isn't the Oracle timestamp based on the elapsed seconds since some date in 1970 or something? It seems there should be an algorithm to convert but I just haven't found it.

  • Conversion from DATE to TIMESTAMP datatype

    Hello,
    My issue is as follows:
    1. I have one variable of type DATE, which I assign the value of SYSDATE
    mydatevar DATE:= SYSDATE;2. I want to find *"today"*, truncated to DAY
      TRUNC (mydatevar, 'DD')
    TRUNC function returns DATE datatype. So I will receive in point 2 for example *'2010-01-13 00:00:00'*.
    3. I want to assign the value from point 2 to a variable of type TIMESTAMP
      mytimestampvar TIMESTAMP := mydatevar;which implicitly will convert the DATE variable to TIMESTAMP.
    Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".
    Question: How can I convert from DATE to TIMESTAMP keeping hours and minutes zeros?
    Why I need this conversion: I have a table with a column "column1" TIMESTAMP(0) and I would like to take only those rows from the table, where "column1" is in range from today 12 o'clock in the morning till now (whatever hour it is).
    NLS characteristics of the database:
    PARAMETER                           VALUE
    NLS_LANGUAGE                           AMERICAN
    NLS_TERRITORY                   AMERICA
    NLS_CURRENCY     $
    NLS_ISO_CURRENCY                    AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CHARACTERSET                    AL32UTF8
    NLS_CALENDAR                            GREGORIAN
    NLS_DATE_FORMAT                    DD-MON-RR
    NLS_DATE_LANGUAGE            AMERICAN
    NLS_SORT     BINARY
    NLS_TIME_FORMAT                     HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT             DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                             BINARY
    NLS_LENGTH_SEMANTICS               BYTE
    NLS_NCHAR_CONV_EXCP             FALSE
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_RDBMS_VERSION             10.2.0.4.0Session parameters are the same.
    DBTIMEZONE is "+02:00".

    Verdi wrote:
    Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
    Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
    You can see what is actually stored by using the DUMP function:
    SQL> SELECT  DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
      2  ,       DUMP(TRUNC(SYSDATE,'DD')) AS DT
      3  FROM DUAL
      4  /
    TSTAMP                                                                      DT
    Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0                  Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
    HTH!
    Edited by: Centinul on Jan 13, 2010 7:23 AM

  • Remove milliseconds from timestamp in write to measurement file

    I'm logging data to a binary tdms file using the write to measurement file express vi. I choose my x axis to be time and see that an absolute timestamp is written with millisecond precision. I only need to-the-second precision. Is there anyway to change this default behavior?
    Attachments:
    remove.png ‏10 KB
    remove.png ‏10 KB

    Where is your data coming from. When I open the express vi to look, it looks like the time format doesn't determine that, but the
    signal data cluster coming in does. So where does the data come from, and in what form?
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Removing milliseconds from timestamp

    Hello.
    I'm having problems with a date value (of type java.sql.Timestamp).
    I need to convert:
    java.sql.Timestamp date1 = 2005-05-11 12:12:30.40
    I want to delete the milliseconds from the date above and format it as:
    05/11/2005 12:12:30
    How can I do this? I've tried:
    SimpleDateFormat sdf= new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    String tempDate = sdf.format(date1);
    But how do I now convert tempDate back to a timestamp?
    Thanks for your help!

    The output I'm looking for is 05/19/2005 13:38:37.
    I don't want to .0 at the end.Then create a SimpleDateFormat that doesn't include millis.
    Also, if only strings, etc. can be formatted, how can
    I convert a string to a timestamp?SimpleDateFormat.parse gives you a Date. Timestamp has either a constructor or a setter method that takes a Date or the Date's long from its getTime() method.
    Dates and Timestamps are just numbers--how many millis or nanos or whatever elapsed since the epoch.

  • Adding Millisecond to timestamp and group the value.

    Dear All,
    i wanted to add 1000Millisecond to timestamp and group all the data which contains in that 1000 Millisecond interval.
    For EG:
    Input:
    GPS_TIME                            
    2013-04-25 21:03:34.873000
    2013-04-25 21:03:35.210000
    2013-04-25 21:03:35.700000
    2013-04-25 21:03:35.903000
    2013-04-25 21:03:36.233000
    2013-04-25 21:03:36.233000
    2013-04-25 21:03:36.680000
    2013-04-25 21:03:36.680000
    2013-04-25 21:03:36.933000
    Output:
    If we add 1000Millisecond to 1st GPS_TIME, the time would be  2013-04-25 21:03:35.873000. SO i need to give unique number to rows falls between  2013-04-25 21:03:34.873000  and   2013-04-25 21:03:35.873000 and then add  1000 millisecond to 2013-04-25 21:03:35.903000 and so on like below.
    GPS_TIME                           GROUP_ Number
    2013-04-25 21:03:34.873000      1
    2013-04-25 21:03:35.210000      1
    2013-04-25 21:03:35.700000       1
    2013-04-25 21:03:35.903000      2
    2013-04-25 21:03:36.233000      2
    2013-04-25 21:03:36.233000      2
    2013-04-25 21:03:36.680000      2
    2013-04-25 21:03:36.680000     2
    2013-04-25 21:03:36.933000     3
    Can you please help me out to do this.
    Thanks All

    with
    gps_time as
    (select to_timestamp('2013-04-25 21:03:34.873000','yyyy-mm-dd hh24:mi:ss.ff') gps_timestamp from dual union all                  
    select to_timestamp('2013-04-25 21:03:35.210000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:35.700000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:35.903000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:36.233000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:36.233000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:36.680000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:36.680000','yyyy-mm-dd hh24:mi:ss.ff') from dual union all
    select to_timestamp('2013-04-25 21:03:36.933000','yyyy-mm-dd hh24:mi:ss.ff') from dual
    select gps_timestamp,dense_rank() over (order by grp) group_number
      from (select gps_timestamp,trunc(sum(diff) over (order by gps_timestamp)) grp
              from (select gps_timestamp,
                           extract(second from (gps_timestamp - lag(gps_timestamp,1,gps_timestamp) over (order by gps_timestamp)) day to second) diff
                      from gps_time
    GPS_TIMESTAMP
    GROUP_NUMBER
    25-APR-13 09.03.34.873000000 PM
    1
    25-APR-13 09.03.35.210000000 PM
    1
    25-APR-13 09.03.35.700000000 PM
    1
    25-APR-13 09.03.35.903000000 PM
    2
    25-APR-13 09.03.36.233000000 PM
    2
    25-APR-13 09.03.36.233000000 PM
    2
    25-APR-13 09.03.36.680000000 PM
    2
    25-APR-13 09.03.36.680000000 PM
    2
    25-APR-13 09.03.36.933000000 PM
    3
    Regards
    Etbin

  • Conversion of LOB to timestamp in Oracle 10G

    Hi all,
    I am having a problem in converting a LOB ( which will have date value) to timestamp.
    My LOB value will be in the format "(CLOB) 19/Feb/09 07:25 PM".
    And I need to convert it into timestamp format with format 'dd-MON-yy HH:MI:SS AM'.
    When I convert the LOB to char using to_char(dbms_lob.substr(oldstring, 18, 1)) where oldstring is the column name, I will get the value in the format '19/Feb/09 07:25 PM'. But after that I was not able to convert it into timestamp as I am getting the message 'ORA-01858' related to non-numeric character when it is expecting a numeric character.
    Does anyone had this problem or is anyone having solution to this?
    Thanks in advance..
    -Raghu

    And if you're worried about losing the time element... it's not lost
    SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi:ss'
      2  /
    Session altered.
    SQL> create table test
      2  (oldstring clob)
      3  /
    Table created.
    SQL>
    SQL> insert into test values ('19/Feb/09 07:25 PM')
      2  ;
    1 row created.
    SQL> select to_date (substr (oldstring, 1, 18), 'dd/Mon/rr hh:mi AM')
      2    from test;
    TO_DATE(SUBSTR(OLDS
    19-02-2009 19:25:00
    SQL> drop table test
      2  /
    Table dropped.
    SQL>

  • Time Zone conversion of a date/timestamp in ABAP

    Is there a function available in 4.5B that can convert a date/timestamp from one timezone to another?

    try FMS
    /SAPTRX/RANGE_CONVERT      
    CONVERT_TIME_TERMS         
    CIF_GEN3_CONVERT_DATETIME  
    CIF_GEN3_CONVERT_TIMESTAMP 
    CIF_GEN_CONVERT_DATETIME   
    CIF_GEN_CONVERT_TIMESTAMP  
    CIF_GEN4_CONVERT_DATETIME  
    CIF_GEN4_CONVERT_TIMESTAMP 
    CO_SF_CONVERT_TIMES_OPR    
    CXTP                       
    DATE_TIME_CONVERT          
    POINT_IN_TIME_CONVERT      
    FITP_CONVERT_LOCAL_TIME_GMT
    <u><i><b>
    Tip : GO to -> SE37 and search key word TIME OR Convert</b></i></u>
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • 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

  • Java time to DB2 timestamp conversion

    I want to convert current time to following format "2008-01-12 11:46:55.945000". I tried but I an not able to do. Could you pelase hlep me out or is there any easy way to do
              Calendar calendar = Calendar.getInstance();
              //2008-01-12 11:46:55.945000
              int year = calendar.get(Calendar.YEAR);
              int date = calendar.get(Calendar.DATE);
              int month = calendar.get(Calendar.MONTH);
              int hour = calendar.get(Calendar.HOUR);
              int minite = calendar.get(Calendar.MINUTE);
              int second = calendar.get(Calendar.SECOND);
              int millisecond = calendar.get(Calendar.MILLISECOND);
              String timestamp = year+"-"+date+"-"+month+" "+hour+":"+minite+":"+second+"."+millisecond;

    have you try like:
    java.sql.Timestamp creationdate = new java.sql.Timestamp(new Date().getTime());
    prepStmt.setTimestamp(1, creationdate);or format the date as "yyyy-MM-dd HH:mm:ss" like string by using SimpleDateFormat
    and use
    java.sql.Timestamp creationdate =
                   java.sql.Timestamp.valueOf(creationDate);

  • Using stored procedures with a timestamp parameter with Delphi  and ADO

    Dear Oracle experts,
    I have a problem concerning using a stored procedure with Delphi.
    I try to use a stored procedure which hast two input parameters ( a integer and a timestamp).
    The timestamp parameter is my problem since I would like to use the "to_timestamp"
    Oracle-function to create the timestamp parameter to be inserted into my procedure.
    If I insert the to_timestamp statement as a adodatetime I have to perform the conversion to the oracle timestamp in my application.
    If I want to use the to_timestamp statement I have to use the ftstring datatype but in that case I get an error because I use a string as input for my procedure were it awaits a timestamp.
    So the problem seems to be that the function call "to_timestamp" is not interpreted if it is transferred through my ADO component.
    Do you know how to use a procedure with Delphi (ADO) with a function as input parameter ?
    Best regards,
    Daniel Wetzler
    P.S. :
    This is the Delphi code to use my Procedure.
    FactsTempDS:=TADODataset.Create(nil);
    Sproc1 := TAdoStoredProc.Create(nil);
    Sproc1.Connection := TDBConnection(strlistConnectionstrings.objects[iConnectionIndex]).Connection;
    Sproc1.ProcedureName := 'ECSPACKAGE.PROCFINDINITIALSWITCHSTATE';
    Sproc1.Parameters.CreateParameter ('SwitchID',ftInteger,pdinput,0,0);
    //Sproc1.Parameters.CreateParameter ('StartTime',ftdatetime,pdinput,50,0);
    Sproc1.Parameters.CreateParameter ('StartTime',ftString,pdinput,50,0);
    Sproc1.Parameters.Findparam('SwitchID').value:=SwitchID;
    Sproc1.Parameters.FindParam('StartTime').Value:= 'to_timestamp(''2005/12/30 19:36:21'', ''YYYY/MM/DD HH:MI:SS'')';
    Sproc1.CursorType := ctKeyset;
    Sproc1.ExecuteOptions:=[];
    Sproc1.Open;
    Sproc1.Connection := nil;
    FactsTempDS.Recordset:= sproc1.Recordset;
    if FactsTempDS.RecordCount=0
    then raise Exception.Create('No line switch variable found for switch '+IntToStr(SwitchID)+' before starttime. Check BDE dump filter.')

    I have my entity manager setup in a singleton.
    I'm finding it's costly to generate the emf, but if I don't close the em (enitity manager) and emf (entity manager factory) my open cursor count climbs until I exceed the max number of open cursors on the database (11g RAC)
    I'm committing the connection, and uow, and closing the em at the end of each call.
    But until I close the emf, the open cursors aren't released.
    TransactionhistoryPkg tranPkg = new TransactionhistoryPkg(conn); //Class created over database package via JPublisher
    tranPkg.transactionhistoryInsSp(insertTrans.getCardId()); // executes db package
    tranPkg.closeConnection();
    conn.commit();
    uow.commit();
    uow.getAccessor().decrementCallCount();
    em.close();
    Am I missing something really obvious here??
    btw - I found this link helpful in troubleshooting the max cursors issue: https://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingORA-1000MaximumOpenCursorsExceededPattern.html

  • Conversion mapping is losing time zone data during daylight saving time

    We have a problem with conversion of Calendars to timestamp with timezone for the last hour of Daylight Saving Time (e.g. 01:00 EDT - 01:59 EDT) where it is being interpreted as Standard Time which is in reality 60 minutes later.
    We've written a JUnit test case that runs directly against TopLink to avoid any issues with WAS and its connection pooling.
    The Calendar theDateTime comes from an object called TimeEntry which is mapped to a TIMESTAMP WITH TIMEZONE field using conversion mapping with Data Type TIMESTAMPTZ (oracle.sql) and Attribute Type Calendar (java.util).
    We are using:
    Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build Patch for Bugs 5145690 and 5156075)
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    Oracle JDBC driver Version: 10.2.0.1.0
    platform=>Oracle9Platform
    Execute this Java:
    SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
    TimeZone tzEasternRegion = TimeZone.getTimeZone("US/Eastern");
    Calendar theDateTime = Calendar.getInstance(tzEasternRegion);
    theDateTime.setTime(format.parse("10/29/2006 01:00 EDT"));
    Persist to the database and execute this SQL:
    SELECT the_date_time, EXTRACT(TIMEZONE_REGION FROM the_date_time), EXTRACT(TIMEZONE_ABBR FROM the_date_time), EXTRACT(TIMEZONE_HOUR FROM the_date_time)
    FROM time_table WHERE time_table_id=1
    This provides the following results:
    THE_DATE_TIME EXTRACT(TIMEZONE_REGION FROM the_date_time) EXTRACT(TIMEZONE_ABBR FROM the_date_time) EXTRACT(TIMEZONE_HOUR FROM the_date_time)
    29-OCT-06 01.00.00.000000 AM US/EASTERN US/Eastern EST -5
    The wrong time zone is in the database. It should be EDT -4. Let's test the SQL that should be generated by TopLink. It should look like the following.
    Execute this SQL:
    UPDATE time_table SET the_date_time = TO_TIMESTAMP_TZ('10/29/2006 01:00 US/Eastern','mm/dd/yyyy HH24:MI TZR') WHERE (time_table_id=1)
    SELECT the_date_time, EXTRACT(TIMEZONE_REGION FROM the_date_time), EXTRACT(TIMEZONE_ABBR FROM the_date_time), EXTRACT(TIMEZONE_HOUR FROM the_date_time)
    FROM time_table WHERE time_table_id=1
    This provides the same results:
    THE_DATE_TIME EXTRACT(TIMEZONE_REGION FROM the_date_time) EXTRACT(TIMEZONE_ABBR FROM the_date_time) EXTRACT(TIMEZONE_HOUR FROM the_date_time)
    29-OCT-06 01.00.00.000000 AM US/EASTERN US/Eastern EST -5
    Now, execute this SQL:
    UPDATE time_table SET the_date_time = TO_TIMESTAMP_TZ('10/29/2006 01:00 EDT US/Eastern','mm/dd/yyyy HH24:MI TZD TZR') WHERE (time_table_id=1)
    SELECT the_date_time, EXTRACT(TIMEZONE_REGION FROM the_date_time), EXTRACT(TIMEZONE_ABBR FROM the_date_time), EXTRACT(TIMEZONE_HOUR FROM the_date_time)
    FROM time_table WHERE time_table_id=1
    This provides better results:
    THE_DATE_TIME EXTRACT(TIMEZONE_REGION FROM the_date_time) EXTRACT(TIMEZONE_ABBR FROM the_date_time) EXTRACT(TIMEZONE_HOUR FROM the_date_time)
    29-OCT-06 01.00.00.000000 AM US/EASTERN US/Eastern EDT -4
    The correct time zone is now in the database. Let's test reading this with the following Java:
    System.out.println("cal= " + theDateTime);
    System.out.println("date= " + theDateTime.getTime());
    System.out.println("millis= " + theDateTime.getTimeInMillis());
    System.out.println("zone= " + theDateTime.getTimeZone());
    This provides the following results:
    cal= java.util.GregorianCalendar[...]
    date= Sun Oct 29 01:00:00 EST 2006
    millis= 1162101600000
    zone= sun.util.calendar.ZoneInfo[id="US/Eastern",...]
    The TimeZone object is correct since we are using the US/Eastern regional time zone, but the millis are wrong which makes the time EST instead of EDT. The millis should be 1162098000000.
    The conversion from java.util.Calendar to TIMESTAMPTZ loses the actual offset when setting to a regional time zone. It can maintain this info by specifying it explicitly.
    The conversion from TIMSTAMPTZ to java.util.Calendar also loses the actual offset even if the correct offset is in the database.
    Has anyone else encountered this conversion problem? It appears to be a conversion problem in both directions. I know that the Calendar is lenient by default and will assume Standard Time if time is entered during the repeated 1 o'clock hour at the end of Daylight Saving Time, but the Calendars we are using are explicit in their time, so this would be classified as data corruption.
    Nik

    Opened an SR. Looks like there is a problem with conversion either in TopLink or in JDBC.

  • Timezone effects on Date and Timestamp fields in af:query component

    Hello,
    I'm working on an ADF application where time zone is configured as follows:
    * Dynamic View Layer time zone is configured in trinidad-config.xml file and bound to a session scoped value:
    <trinidad-config>
      <skin-family>fusionFx</skin-family>
      <time-zone>#{sessionScope.tz}</time-zone>
    </trinidad-config>* ADF BC time zone is configured in adf-config.xml file and bound to View Layer time zone:
    <adf-config>
      <user-time-zone-config xmlns="http://xmlns.oracle.com/adf/usertimezone/config">
        <user-timezone expression="#{adfFacesContext.timeZone.ID}"/>
      </user-time-zone-config>
    </adf-config>The problem here is that Dates and Timestamp values work as expected all over the application except for the af:query component. When displayed as af:inputDate in af:form, Dates and Timestamp values are NOT getting converted to the time zone (TZ) configured in trinidad-config.xml file, whereas TimestampTz and TimestampLtz are. However, when displayed in af:query component, Dates and Timestamp values are automatically converted to View Layer TZ after a search has been performed.
    For example, say View Layer TZ = US/Pacific and we enter 01/jun/2011 as a search criteria of type Date and then click on the Search button. The displayed value automatically changes to 25/nov/2011, that is, it gets converted to the WLS JVM time zone, which is set to Europe/London.
    Is conversion of Date and Timestamps in af:query component the expected behaviour or could this be a bug?
    Is there any way to avoid this conversion?
    Thanks in advance
    Version:
    ADF Business Components 11.1.1.59.23
    Java(TM) Platform 1.6.0_21
    Oracle IDE 11.1.1.4.37.59.23
    PMD JDeveloper Extension 4.2.5.3.0
    Repost on 26-nov-2011 9:29
    Repost on 28-nov-2011 15:10
    Edited by: Barbara Gelabert on 26-nov-2011 9:29
    Edited by: Barbara Gelabert on 28-nov-2011 15:10

    Hi,
    Thanks for your reply. This certainly seems promising. However, I am getting a connection error now.
    The following...
    jar_loaded = require 'ojdbc14.jar'
    puts "Oracle jar loaded? #{jar_loaded}"
    puts "Starting active record"
    require 'rubygems'
    gem 'activerecord'
    gem 'activerecord-oracle_enhanced-adapter'
    require 'activerecord'
    puts "Connecting to MXGN"
    ActiveRecord::Base.establish_connection(
    :adapter => 'oracle_enhanced',
    :host => 'THEHOST',
    :port => '1550',
    :database => 'THEDB',
    :username => 'THEUSER',
    :password => 'THEPASSWORD'
    ... produces
    Oracle jar loaded? true
    Starting active record
    Connecting to MXGN
    ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install ojdbc14.jar library.
    ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install ojdbc14.jar library.
    C:/jruby/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the oracle_enhanced adapter: `gem install activerecord-oracle_enhanced-adapter` (LoadError) (RuntimeError)
    from H:\sandbox\DBPlay\lib\main_enhanced.rb:12
    I'm confused. Am I missing the driver, or have I failed to setup the enhanced Oracle adapter?
    I have tried moving the jar to $JRUBY_HOME/lib too, but the result was the same.
    All help would be greatly appreciated.
    Many Thanks
    Adrian

  • Task Details - Active Core Time and ms to hh:mm:ss conversion bug

    Hey all,
      In a Azure Batch App Job, each task has a "Active Core Time" value set when it completes. There is a bug in the conversion of milliseconds to hours/minutes/seconds. It appears to overflow on a day (Core time > 24 hours)
    These are from an A4 (8 Core) machine:
    3 Hour Task: 54m 21s (89661136 ms)
    3 Hour task: 23h 9m 18s (83358872 ms)
    4 Hour Task: 7h 45m 3s (114303288 ms)
    On the first one, 89661136 is 24 hours and 54 minutes. The last one is 31.7 hours.
    ----- Ed

    Hi Ed, 
    Thanks for bringing this to our attention. Just to clarify, are you seeing this behavior in the Mission Control portal, or the task API? I can see an Active Core Time in the task details panel in the portal so i am pretty sure that is what you are referring
    to.
    I will sort out a fix for this in the near future. 
    Regards,  
    Andrew

Maybe you are looking for

  • Connecting my 6630 via USB

    O/S - Win XP SP 2 Phone - 6630 PC Suite - 6.81.13 Hi I'm trying to connect my 6630 via USB, i've installed and re installed PC suite but even though Windows recognises my phone, and installs the drivers etc. the Get Connected dialog on PC Suite shows

  • TS1368 Can't get into updates section in the app store on my iPhone

    I can acess the app store on my iPhone but when I click on the updates tab it says "cannot connect to the iTunes store" which is weird because I can still download apps and search them.... Can anyone suggest how I can fix this?

  • How to declare an array

    Hi , how do i actually declare an array of size 10 ? but i do not want to initialise the size which i will get after some processing String Array[]; int arrysize ; arrysize = Getsize(); so how to declare the size here pls help tks & rdgs

  • How to map ports 8081 and 8082

    I tried using the general port mapping instruction without success.  As much as I like my Airport Extreme, I am ready to replace it if I can not get any help. Thanks

  • Network Printer Problem from Mac to Windows

    Hi all, hoping someone can help. I have a Canon MF4350d printer which is shared on a windows machine. I can access the windows machine, I have installed the latest drive for this printer onto my mac, from the canon website and when i go to print I ge