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

Similar Messages

  • Disallowed implicit conversion from data type datetime to data type timestamp

    Received error: [Macromedia][SQLServer JDBC
    Driver][SQLServer]Disallowed implicit conversion from data type
    datetime to data type timestamp, table 'myTbl', column 'duration'.
    Use the CONVERT function to run this query.
    I have a field named duration hh:mm:ss.lll that I am trying
    to insert into MS SQL. DB has field defined as [duration]
    [timestamp] NOT NULL,
    My insert has this: INSERT INTO myTbl( duration) VALUES(
    <cfqueryparam value="2006-05-26 11:12:13"
    cfsqltype="CF_SQL_TIMESTAMP"/> )
    Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
    seconds as 13.111 which did not work. Does the db duration need to
    be date? I just want to store a duration for the time of a movie...
    10 Q

    quote:
    Originally posted by:
    quiet1
    Received error: [Macromedia][SQLServer JDBC
    Driver][SQLServer]Disallowed implicit conversion from data type
    datetime to data type timestamp, table 'myTbl', column 'duration'.
    Use the CONVERT function to run this query.
    I have a field named duration hh:mm:ss.lll that I am trying
    to insert into MS SQL. DB has field defined as [duration]
    [timestamp] NOT NULL,
    My insert has this: INSERT INTO myTbl( duration) VALUES(
    <cfqueryparam value="2006-05-26 11:12:13"
    cfsqltype="CF_SQL_TIMESTAMP"/> )
    Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
    seconds as 13.111 which did not work. Does the db duration need to
    be date? I just want to store a duration for the time of a movie...
    10 Q
    Duration as a timestamp? How odd, most people would store it
    as an integer. Or, if you want to build your own string, the syntax
    is {ts 'yyyy-mm-dd hh:mm:ss'}. The seconds might not be required.
    In any event, use createodbcdatetime() for the value you want
    to put into your table.

  • Implicit Conversion from data type sql_variant to datetime is not allowed.

     Getting a odd error. This code was working perfectly before a SQLServer upgrade.
    The linked database is working, I'm able to pull up data from it in separate queries just fine.
    I'm getting the following error.
    Implicit conversion from data type sql_variant to datetime is not allowed. Use the CONVERT function to run this query.
    Invalid column name 'TotalDay'. (.Net SqlClient Data Provider)
    can anyone spot the issue? I've tried sever variations of the same code, but still get the same thing.
    If I put this section in a query by it self it works just fine.
    ( DATEDIFF(ss,
    CONVERT(VARCHAR(10),( SELECT TOP ( 1 )
    TimeDate
    FROM [nav].AcsLog.dbo.EvnLog AS X3
    WHERE UDF2 = E.No_
    AND CONVERT(VARCHAR(10), X3.TimeDate, 101) = CONVERT(VARCHAR(10), @sdate, 101)
    ORDER BY TimeDate ASC
    ),101),
    CONVERT(VARCHAR(10),( SELECT TOP ( 1 )
    TimeDate
    FROM [nav].AcsLog.dbo.EvnLog AS X4
    WHERE UDF2 = E.No_
    AND CONVERT(VARCHAR(10), X4.TimeDate, 101) = CONVERT(VARCHAR(10), @sdate, 101)
    ORDER BY TimeDate DESC
    ),101)) ) AS TotalDayBadge ,

    >ANDCONVERT(VARCHAR(10),X3.TimeDate,101)=CONVERT(VARCHAR(10),@sdate,101)
    It is not a good idea to use string dates for predicates in WHERE clauses.
    Use DATETIME or DATE in predicates.
    If you are not interested in the time part of DATETIME, use DATE datatype.
    Example:
    SELECT CONVERT(DATE, getdate());
    -- 2014-08-25
    Datetime conversions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Between dates:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Conversion from date to number & display a date in a textfield

    I Have 2 issues
    The first one:
    I need to extract the hour from a date variable.
    This is the code I already have:
    NUM_TOT := NUM_TEL + to_number('PROGRAMMINGS1.PRG_START','hh24');
    NUM_TOT & NUM_TEL are number variables,
    PROGRAMMINGS1.PRG_START is a Textfiel with a dateformat. There can only be an houre like 24:59:00 entered.
    So in this example I just want the houre and convert it to a number.
    The second:
    I want to make a date from a few numbers & then display it in a texfield.
    This is the code I already have:
    VAR_DATE := NUM_TEL || ':' || NUM_LENGTH || ':00';
    :PROGRAMMINGS.PRG_END := to_date(VAR_DATE,'hh24:mi:ss');
    Between the 2 lines of code i places a message(VAR_DATE) for testing.
    When the program display VAR_DATE then i can see the good date at the bottom of the screen.
    But when I place my variable in the textfield it looks like: 00:00:00. What am I doing wrong?
    Who can help me.
    With regards
    Stefanie

    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

  • How to Calculate column (Month, Year) from date or timestamp

    Hi,
    Name
    SQL Data Type
    Dimension
    Column Store Data Type
    Key
    Not Null
    Default
    Comment
    T_STAMP
    TIMESTAMP
    LONGDATE
    How to generate Month and Year from timestamp field in Analytic View.
    Please provide me some valuable input. I have searched SCN before posting this discussion.

    Hi KD,
    You can apply the following formulas in the expression:
    For Year :
    leftstr(string("Timestamp"),4)
    For Month:
    midstr(string("Timestamp"),6,2)
    Regards,
    Krishna Tangudu

  • SQL Developer 3.2 - Exporting data with TIMESTAMP datatype

    Hi,
    We have users that are attempting to export data with the Timestamp format to Excel (xls format) using SQL Developer 3.2.  When attempting to sort the Timestamp in either asc or desc order, Excel is having issues sorting correctly.  I suggested that the user just do all the sorting within their SQL Developer session but they require the ability to slice and dice in Excel.
    This is definitely not an issue with Excel as the users have previously exported Timestamp data from Toad and been able to sort without issue.  Any thoughts as to what might resolve this issue? 
    Thanks.

    We're not formatting timestamps in Oracle as numbers/dates in Excel. They'll need to properly format the Excel column/cells to get it to sort the way they want vs being treated as simple strings.

  • Create New Value from Date and Timestamp

    I have a date column and a timestamp column. I want to create a timestamp from the date portion of the date column and the time portion of the timestamp column. This is the pseudocode:
    select timestamp( date_portion(date_col), time_portion(timestamp_col) ) as new_timestamp from table
    Please show me how to write the Oracle SQL for best performance.

    You can do this:
    with test as (
       select
       to_date('2011-10-14 11:00:00','YYYY-MM-DD HH24:MI:SS') date_col,
       to_timestamp('2011-10-13 20:20:20.123456','YYYY-MM-DD HH24:MI:SS.FF') timestamp_col
       from dual
    -- end of test data
    select
    to_timestamp(
       to_char(date_col,'YYYY-MM-DD')
       ||' '||
       to_char(timestamp_col,'HH24:MI:SS.FF'),
       'YYYY-MM-DD HH24:MI:SS.FF'
    ) new_timestamp
    from test
    ;This takes the date-part of date_col (2011-10-14), concatenates with the time-part of timestamp_col and converts to a timestamp.
    (But it would have been easier simply not to have the date column and just let the timestamp column have both date and time information :-) )

  • Conversion from Date to say Locale time

    Hello All,
    I receive a date in xml file as a string. eg 01/27/2004 . I have to convert it to Locale format(2005-01-10T12:30-04:10) using XSL. Is it possible ?. If yes how to do that ?.
    Thanks and regards,
    Sachin

    Hello All,
    I am very sorry for framing the question wrongly. Actually I have recieved the date and time from xml which I will concat and store it in <xsl:variable>. Now I want to do processing on the variable using Java. Is it possble to do so ?. Means can I call some java function and pass the variable to the function do the processing on the variable and return the output and save that output in some variable which can be displayed.
    Thanks in advance.
    Waiting for reply.

  • Conversion from data to duration

    Hi,
    I wish to convert a number, in seconds, to a duration.
    As follow: convert 289, which is in seconds, to a duration, which would be in minutes and seconds.
    289 seconds is 4 minutes 49 seconds, but how can I convert this in numbers?
    I also need to convert a full column of many numbers just as this one, how can I quickly convert many numbers like 289 (representing seconds) in a column in a duration?
    Thanks a lot in advance to all who can help,
    Paul

    Hi Contello,
    Thanks for your answer!
    It would be nice to be able to that automatically when having an entire column of data such as the one I told you about ... How could I do that?
    If I tell numbers 289 alone is a duration, it takes it as if it was 289 hours, not seconds!
    The only trick I found is to keep it as if it was hours, and then get a new cell next, in which the cell containing 289 is divided by 60 twice. Then it gives me 289 seconds converted in minutes and seconds, 4 min 49.
    Quite tricky isn't it?
    Is there a more "proper" way to do this?
    I really need to apply it to a big crunch of values ... So I need it to be automatic.
    Cheers!

  • ORACLE TIMESTAMP DataType support in Toplink ?

    Currently we have an application that need to create timestamps with precision up to thousands of a second.
    Do you know of any other customer that have similar requirements and how they solve this problem ?
    We try changing the SQL DDL to change datatype from DATE to TIMESTAMP(3) which can support a timestamp of 1/1000 seconds precision.
    We find that if our Oracle column is defined as Oracle DATE, the last 3 digit will be drop and cause us some duplicate key exception for records that
    Get inserted within 1 second because the timestamp is part of the primary key.
    ts '2004-03-12 17:13:27.792'
    So we change the ORACLE column from DATE to TIMESTAMP(3)
    What we find is that Toplink produce this exception
    Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [oracle.sql.TIMESTAMP@321b5e39], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.util.Date].
    at oracle.toplink.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:35)
    at oracle.toplink.internal.helper.ConversionManager.convertObjectToUtilDate(ConversionManager.java:679)
    at oracle.toplink.internal.helper.ConversionManager.convertObject(ConversionManager.java:97)
    at oracle.toplink.internal.databaseaccess.DatabasePlatform.convertObject(DatabasePlatform.java:55
    Than we try to change our java code and modify the java instance variable type from java.util.Date to java.sql.Timestamp
    And we get the following error
    Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [oracle.sql.TIMESTAMP@731de027], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.sql.Timestamp].
    at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:650)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1011)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1564)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:335)
    We cannot seems to find in toplink mapping workbench how to specify timestamp
    ========================================================================================================
    The TIMESTAMP Datatype
    The new TIMESTAMP datatype is almost identical to DATE and differs in only one way:
    TIMESTAMPs can represent fractional seconds.
    The granularity of a TIMESTAMP value can be as little as a billionth of a second, whereas
    DATE variables can only resolve time to the second.
    When you declare a TIMESTAMP variable, you can optionally specify the precision that you wish to use for fractional seconds. The default precision is to the millisecond (six decimal digits); the maximum precision is to the billionth of a second (nine decimal digits).
    ===========================================================================================================
    -----Original Message-----
    From: Cheung, Ka-Kit
    Sent: Friday, March 12, 2004 6:20 PM
    To: Burr, Tim; Julian, Robert; Matthiesen, Sean
    Cc: Tsounis, George; Del Rosso, Peter; Cham, Mei
    Subject: Problem identified : AddressDetail duplicate key problem
    If we look at the exact of the insert statement.
    We see that the last address detail insert have key of
    Address ID = '5a052407-dac6-42ad-bbbf-29edc94488c1', and
    TransactionStartDate = {ts '2004-03-12 17:13:27.792'},
    While in the database, we look like we have an entry of
    Address ID = '5a052407-dac6-42ad-bbbf-29edc94488c1', and
    TransactionStartDate = {ts '2004-03-12 17:13:27.229'},
    If my memory served me right, while
    {ts '2004-03-12 17:13:27.792'}, is different than {ts '2004-03-12 17:13:27.229'},
    because are Java timestamps that have precison up to MicroSeconds, therefore 229 is different than 792.
    However, when this timestamp is saved to Oracle, I believe (have to check with Mei) that oracle only takes
    Up to '2004-03-12 17:13:27’ and discard the 229 or 792 because that is the maximum precision of timestamp for oracle.
    So we have the second insert have the same '2004-03-12 17:13:27’ after stripping off the 792 and we have a same record with the same same '2004-03-12 17:13:27’ in the database and
    Therefore causing duplicate key exception.
    That is why this is happen only once in a while when 2 rapid fire inserts happen in less than 1 second of each other.
    The solution actually is in the ESS code itselfs.
    The current ESS code will send addDependentToClient multiple times, one for each dependent added
    On the screen.
    The right way is to add all the dependent on the screen all at once.
    To have “course grain” method like addDependentsToClient, and have a collection or array of dependents as input parameter.
    This way we are not causing the participant to create history of themselves multiple times within a very short period of time. It save disk space, conform to a single UOW per submit and that is what I proposed
    To solve this problem from the root cause is by enhancing the method to save multiple dependents in one shot rather than a loop of multiple calls.
    KK
    and
    INSERT INTO PTTCBSI.ADDRESS_DETAIL
    (LINE_3_AD, ADR_TRAN_UNTIL_DT, MODIFY_DT, CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD, ADR_TRAN_START_DT, CREATE_DT, AUTHOR_ID, ADDRESS_ID, LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID)
    VALUES ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'},
    {ts '2004-03-12 17:13:26.385'},
    'Oakwood', '61043', 1, '1234', 'Mailstop 820',
    {ts '2004-03-12 17:13:26.385'},
    {ts '2004-03-12 16:50:12.0'}, 'dataLoad',
    '5a052407-dac6-42ad-bbbf-29edc94488c1',
    'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
    UnitOfWork(1238222885)--Connection(2102560837)--
    UPDATE PTTCBSI.ADDRESS_DETAIL
    SET ADR_TRAN_UNTIL_DT = {ts '2004-03-12 17:13:26.385'}, VER_ID = 2 WHERE
    (((ADDRESS_ID = '5a052407-dac6-42ad-bbbf-29edc94488c1') AND
    (ADR_TRAN_START_DT = {ts '2004-03-12 16:52:29.0'})) AND (VER_ID = 1))
    UPDATE PTTCBSI.ADDRESS_DETAIL SET
    ADR_TRAN_UNTIL_DT = {ts '2004-03-12 17:13:27.229'}, VER_ID = 2
    WHERE (((ADDRESS_ID = '5a052407-dac6-42ad-bbbf-29edc94488c1') AND (ADR_TRAN_START_DT = {ts '2004-03-12 17:13:26.0'})) AND (VER_ID = 1))
    UnitOfWork(102762535)--Connection(2102560837)--
    INSERT INTO PTTCBSI.ADDRESS_DETAIL
    (LINE_3_AD, ADR_TRAN_UNTIL_DT, MODIFY_DT, CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD, ADR_TRAN_START_DT, CREATE_DT, AUTHOR_ID, ADDRESS_ID, LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID) VALUES
    ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'}, {ts '2004-03-12 17:13:27.229'}, 'Oakwood', '61043', 1, '1234', 'Mailstop 820',
    {ts '2004-03-12 17:13:27.229'},
    {ts '2004-03-12 16:50:12.0'}, 'dataLoad',
    '5a052407-dac6-42ad-bbbf-29edc94488c1',
    'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
    INSERT INTO PTTCBSI.ADDRESS_DETAIL
    (LINE_3_AD,
    ADR_TRAN_UNTIL_DT,
    MODIFY_DT,
    CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD,
    ADR_TRAN_START_DT,
    CREATE_DT,
    AUTHOR_ID,
    ADDRESS_ID,
    LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID) VALUES
    ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'},
    {ts '2004-03-12 17:13:27.792'},
    'Oakwood', '61043', 1, '1234',
    'Mailstop 820',
    {ts '2004-03-12 17:13:27.792'},
    {ts '2004-03-12 16:50:12.0'},
    'dataLoad',
    '5a052407-dac6-42ad-bbbf-29edc94488c1',
    'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
    ClientSession(790235177)--Connection(2102560837)--rollback transaction
    ORA-00001: unique constraint (PTTCBSI.PK_ADDRESS_DETAIL) violated

    KK,
    We are back-porting the support for oracle.sql.TIMESTAMP to 9.0.4 in an upcoming patch-set. It is possible to enhance TopLink using a customer conversion manager or database platform to add this support if required in the short term.
    Doug

  • Timestamp datatype not output correctly in table export

    When using the data export from table view timestamp datatype is not handled correctly. It shows as oracle.sql.TIMESTAMP@14c0761.
    Works fine from SQL Explorer view though.

    Im using the same build. 1.0.0.15.27.
    You can try any export option. I tried SQL Insert.
    If you right click from the data grid (SQL Worksheet or Table view it works fine)
    In the table view, if you go to Actions -> Export -> SQL Insert then it doesn't.

  • 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

  • Does CAST ( date as timestamp) causes performance issues

    Hi
    does casting from DATE to TIMESTAMP in a query or in a view causes the slow down of performance??
    Please guide...
    Thanks
    Rimpi

    Everything you do affect performance. How significantly is a question answered by testing not by asking questions on an OTN forum.
    Create a loop doing it 10,000 times and find out.
    And, in the future, always include your version number.

  • Conversion from string "20041023 " to type 'Date' is not valid.

    Hi ,
       I have a table with one of the column(EmpHiredate) datatype is char(10). It has value like "20141023". I need to display this value as date format(dd/mm/yyyy) in report. 
    Following methods i tried in textbox expression but no luck.
    =Format(Fields!EmpHireDate.Value,"dd/MM/yyyy")
    =Cdate(Fields!EmpHireDate.Value)
    Error:
    [rsRuntimeErrorInExpression] The Value expression for the textrun ‘EmpHireDate.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "20041023  " to type 'Date' is not valid.
    Is it possible to convert string to date using SSRS textbox expression ? Can anyone help me with the solution.
    Thanks,
    Kittu

    Hi Jmcmullen,
         Found one more issue on the same. I have one value like "00000000" for the column(EmpHiredate)
    , when i use above expression values(ex:"20141023")
    are displaying in dd/MM/yyyy format in report except value like "00000000" and giving following error:
    [rsRuntimeErrorInExpression] The Value expression for the textrun ‘EmpHireDate.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "0000/00/00" to type 'Date' is not valid.
    Even i tried to pass its original value("00000000") as below but no luck.
    =IIF(Fields!EmpHireDate.Value = "00000000","00000000",Format(CDATE(MID(Fields!EmpHireDate.Value,1,4) + "/" + MID(Fields!EmpHireDate.Value,5,2) + "/" + MID(Fields!EmpHireDate.Value,7,2)),"dd/MM/yyyy"))
    Also tried this:
    =IIF(Fields!EmpHireDate.Value = "00000000","2000/10/21",Format(CDATE(MID(Fields!EmpHireDate.Value,1,4) + "/" + MID(Fields!EmpHireDate.Value,5,2) + "/" + MID(Fields!EmpHireDate.Value,7,2)),"dd/MM/yyyy"))
    Please Suggest. 
    Thanks ,
    Kittu

  • How to get a time part from Date datatype

    Hi,
    I would like to know how to extract the timestamp alone from DATE datatype? If my input is '27-SEP-2011 23:59:00' I need the output as 23:59:00. I am surprised to see that there are no in-built functions for this or may be I am wrong. Basically I need to remove the date part from DATE data type and get the time.Please assist.
    -Thanks
    Edited by: user9546145 on Sep 27, 2011 2:24 PM
    Edited by: user9546145 on Sep 27, 2011 2:25 PM

    Hi,
    user9546145 wrote:
    Hi,
    I would like to know how to extract the timestamp alone from DATE datatype? Be careful! In Oracle, TIMESTAMP means a datatype, similar to but distinct from DATE. You'll avoid confusion if you don't use the word "timestamp" to mean anything else.
    There is a built-in function, TO_CHAR:
    TO_CHAR (dt_col, 'HH24:MI:SS')Depending on how you plan to use the time, TRUNC is another handy built-in function:
    dt_col - TRUNC (dt_col)is a NUMBER (not less than 0, but less than 1) which is suitable for many tasks, such as finding the average time.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

Maybe you are looking for

  • Create a group based on file contents

    Hello! I'm investigating options to create a dynamic group based on periodic check of file content. I have a Shavlik updater which is patching custom groups based on file contents. I would like to create a dynamic group which should return all Window

  • What is the best way to create diary in indesign CS5?

    I need to do something like this fo 2013. Has anyone had experience to create such a diary?

  • MAM 3.0 - Context problem

    Hi All, I am working on MAM3.0 application using MI 7.0. Requirement: To add a check box to the Operation List screen, so that user can check the operation completed and keep track of the completed operations. I have added a check box  to Operation L

  • InDesign CS4 - placing Word document and style mapping

    Hi, I'm using InDesign CS4 on Windows XP (SP3). I've noticed that when I place Word document, do the style mapping and saving this as a preset ... mentioned preset does not save style mapping. It works for the first time but when I try another place

  • MacBook Auto Start with power?

    MacBook Pro is starting up whenever there is any power available to it. It doesn't matter is the AC Adapter is plugged in or not. Plug in the power adapter: it turns on. Shut down: turns back on Shut down with no power adapter: turns back on! Shut do