Convert utc time to oracle date

Hi ,
I want to compare two dates the date passed in will be say '0303090000000' with a dur_date I have in the table X .
dur_date is a DATE type ...
How can i do this in oracle?

Hi,
Should I not use to_char(dur_date 'yyyy-mm-dd hh24:mi:ss') ?No, you should do it the other way around, convert passed string into DATE.
But what format is this string in?
'0303090000000'It seems to be one character too long, and it is unclear what it means. Depending of what meaning you put into it, it can be either one of these:
SQL> alter session set nls_date_format = 'dd-MON-rrrr'
Session altered.
SQL> select to_date('030309000000', 'ddmmyyhh24miss') date_ from dual
union all
select to_date('030309000000', 'ddmmrrhh24miss') from dual
union all
select to_date('030309000000', 'mmddyyhh24miss') from dual
union all
select to_date('030309000000', 'mmddrrhh24miss') from dual
union all
select to_date('030309000000', 'yyddmmhh24miss') from dual
union all
select to_date('030309000000', 'rrddmmhh24miss') from dual
DATE_      
03-MAR-2009
03-MAR-2009
03-MAR-2009
03-MAR-2009
03-SEP-2003
03-SEP-2003
6 rows selected.But probably not 'yyyy-mm-dd hh24:mi:ss'
Regards
Peter

Similar Messages

  • What time the Oracle Data Mining 10g  ?

    What time the Oracle Data Mining 10g ?

    If you are referring to the 10.1 release of the ODM user interface, that should be available in beta form very shortly(a couple weeks) with the final release very soon after that.

  • Converting UTC time stamp to local time (CET)

    Is there a smooth way to convert a time stamp from UTC time into the local time (e.g. CET)?
    CONVERT TIME STAMP.... Just converts the timestamp from local time zone to UTC, is there another comand to perform the opposite conversion?
    TIA!
    /Armin

    Hi Armin
    The statement does not only convert from local time zone to UTC you can specifiy any timezone:
    CONVERT TIME STAMP time_stamp TIME ZONE tz
            INTO [DATE dat] [TIME tim]
            [DAYLIGHT SAVING TIME dst].
    The following statement can also be used to convert from date time to timestamp.
    CONVERT DATE dat [TIME tim [DAYLIGHT SAVING TIME dst]]
            INTO TIME STAMP time_stamp TIME ZONE tz.
    Regards
    Faaiez

  • Insert current date and time into Oracle date type field

    I have a JDBC current date and time insert into Oracle 9i that almost works. It submits the current date and a fixed time into the Oracle date type field. I am using Tomcat 6.0.20.
    For example if I insert the data at 7:24:04 PM on Feb 16, 2010 it will insert as: 16-Feb-2010 12:00:00 AM
    The date part works but the time always shows 12:00:00 AM no matter what date or time the data is inserted.
    Here is what I have for my JDBC inserts and I also tried something with DateFormat:
    PreparedStatement ps; Date mydate = new Date(new java.util.Date().getTime()); //insert statement here.... stmt.setDate(1,mydate);
    I also tried:
    PreparedStatement ps; java.sql.Timestamp mydate = new java.sql.Timestamp(new java.util.Date().getTime()); SimpleDateFormat fmt = new SimpleDateFormat(.... //insert statement here.... ps.setTimestamp(1,fmt.format(mydate));
    Both keep submitting the date into Oracle as 16-Feb-2010 12:00:00 AM
    Anyway to get the current date and time? For example if I insert the data at 7:24.04 pm today it should show as 16-Feb-2010 07:24.04 PM in Oracle.

    sportsMarkr wrote:
    Date mydate = new Date(new java.util.Date().getTime());Please see the javadocs for java.sql.Date and note the part that says "...to zero"
    [http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
    If you want a date and time then use java.sql.Timestamp.

  • Convert millisecond time value to date

    If i have a millisecond time value, say long timeValue, how do I convert this value to a time and a date?

    Or directly set a new date using the constructor
    Date(long date)
    Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
    N.B. - Note that the Date class method to set a date from a long is:
    setTime(long time)
    Sets this Date object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.
    setTimeInMillis() is a Calendar method , only.

  • Query Execution/Elapsed Time and Oracle Data Blocks

    Hi,
    I have created 3 tables with one column only. As an example Table 1 below:
    SQL> create table T1 ( x char(2000));
    So 3 tables are created in this way i.e. T1,T2 and T3.
    T1 = in the default database tablespace of 8k (11g v11.1.0.6.0 - Production) (O.S=Windows).
    T2 = I created in a Tablespace with Blocksize 16k.
    T3 = I created in a Tablespace with Blocksize 4k. In the same Instance.
    Each table has approx. 500 rows (So, table sizes are same in all the cases to test Query execution time ). As these 3 tables are created under different data block sizes so the ALLOCATED no. of data blocks are different in all cases.
    T1  =   8k  = 256 Blocks =  00:00:04.76 (query execution time/elapsed time)
    T2  = 16k=121 Blocks =  00:00:04.64
    T3 =   4k =  490 Blocks =  00:00:04.91
    Table Access is FULL i.e. I have used select * from table_name; in all 3 cases. No Index nothing.
    My Question is why query execution time is nearly the same in all 3 cases because Oracle has to read all the data blocks in each case to fetch the records and there is a much difference in the allocated no. of blocks ???
    In 4k block size example, Oracle has to read just 121 blocks and it's taking nearly the same time as it's taking to read 490 blocks???
    This is just 1 example of different data blocks. I have around 40 tables in each block size tablespace and the result are nearly the same. It's very strange for me because there is a much difference in the no. of allocated blocks but execution time is almost the same, only difference in milliseconds.
    I'll highly appreciate the expert opinions.
    Bundle of thanks in advance.
    Best Regards,

    Hi Chris,
    No I'm not using separate databases, it's 8k database with non-standard blocksizes of 16k and 4k.
    Actually I wanted to test the Elapsed time of these 3 tables, so for that I tried to create the same size
    tables.
    And how I equalize these is like I have created one column table with char(2000).
    555 MB is the figure I wanted to use for these 3 tables ( no special figure, just to make it bigger than the
    RAM used for my db at the db startup to be sure of not retrieving the records from cache).
    so row size with overhead is 2006 * 290,000 rows = 581740000(bytes) / 1024 = 568105KB / 1024 = 555MB.
    Through this math calculation I thought It will be the total table size. So I Created the same no. of rows in 3 blocksizes.
    If it's wrong then what a mes because I was calculating tables sizes in the same way from the last few months.
    Can you please explain a little how you found out the tables sizes in different block sizes.Though I understood how you
    calculated size in MB from these 3 block sizes
    T8K =97177 BLOCKS=759MB *( 97177*8 = 777416KB / 1024 = 759MB )*
    T16K=41639 BLOCKS=650MB
    BT4K=293656 BLOCKS=1147MB
    For me it's new to calculate the size of a table. Can you please tell me then how many rows I can create in each of
    these 3 tables to make them equal in MB to test for elapsed time.
    Then I'll again run my test and put the results here. Because If I've wrongly calculated table sizes then there is no need to talk about elapsed time. First I must equalize the table sizes properly.
    SQL> select sum(bytes)/1024/1024 "Size in MB" from dba_segments> 2 where segment_name = 'T16K';
    Size in MB
    655
    Is above SQL is correct to calculate the size or is it the correct alternative way to your method of calculating the size??
    I created the same table again with everything same and the result is :
    SQL> select num_rows,blocks from user_tables where table_name = 'T16K';NUM_ROWS BLOCKS
    290000 41703
    64 more blocks are allocated this time so may be that's y it's showing total size of 655 instead of 650.
    Thanks alot for your help.
    Best Regards,
    KAm
    Edited by: kam555 on Nov 20, 2009 5:57 PM

  • 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

  • Converting epoch time to a date

    Anyone know of a function to do this. I cant find any in the api and my searches bring up nothing.

    You can create your class that extends GregorianCalendar.Then you can access the protected class in super class. Following codes are what I write to handle this problem. Hope it help.
    import java.util.*;
    public class Test10{
         public Test10(){
              init();
         public void init(){
              MyCalendar calendar1 = new MyCalendar();
              calendar1.set(2002, 07, 12);
              System.out.println("time in epoch: " + calendar1.getTimeInMillis());
         public static void main(String[] str)
              new Test10();
         private class MyCalendar extends GregorianCalendar
              public MyCalendar(){
                   super();
              public long getTimeInMillis()
                   return super.getTimeInMillis();

  • ABAP statement for converting UTC date/ time to local date/time

    Hi
    Is there any abap statement or any function module in BW which converts UTC date and UTC
    time into local date and local time according to specific country.
    Regards,
    Kate

    Hi,
    and to convert the country to a timezone first use: TZ_LOCATION_TIMEZONE
    /manfred

  • Oracle Data Integrator - Real Time Integration

    Hi,
    I want to know that, is there any possibility of integrating data in real-time using Oracle Data Integrator?
    If yes, does it affect the OLTP system performance? (Could it read from db logs,etc..)
    Thanks..

    Using ODI with Logminer-based CDC will affect performance on the source system more than using Oracle Goldengate, let me explain why:
    When using the ODI Logminer-based Journalisation the Logminer functionality will move the primary-key of the affected row into the journal table. When you are then ready to move the changed data, running an interface to move the data reads the Journal-view, which joins the journal table (primary keys) to the source data (and dealing with deleted rows), optimising out duplicate rows in order to bring across the then-current state of the data, which can then be loaded into the target system, on completion, the moved rows can be removed from the journal table. The data will appear in the journal table as soon as Logminer puts it there, which may be a lag of up to two minutes using asynchronous setting, whereas Synchronous Logminer applies "system triggers to the table, with the consequent overhead.
    With Oracle Goldengate, the comitted transactions are read from the log as soon as the log-writer puts the commit into the log. All the data is picked up from the log, at that point. It is then written to the trail-file system of Oracle Goldengate which can be propogated to multiple other systems potentially with sub-second latency, and minimal impact on the source system due to the efficient reading and writing mechanisms. One other consequence of using Oracle Goldengate is that you get every change of the data, not the optimised then-current state of the data when moved.
    Hope this explanation helps.

  • STGeometry Oracle data to SDO ESRI

    Hallo,
    Sorry in advance for my english.
    I am new in this forum.
    Sorry if I ask a question wich has no relevance in this section but I don't even know where to post it.
    I have this problem; there is a migration to work on by the end of next week. The matter is to migrate all geometry oracle data from a version 9.3.1 to an oracle db 11gr2 and convert all the STGeometry Oracle data to SDO ESRI and make them work properly.
    I would really appreciate any suggestion or help or documentation in order to understand how to carry on this task.
    Thanks.

    It is a long time I used ArcSDE, but I think provided you have the correct config (network etc) between primary and standby server, you should be concerned with the ESRI data loading time to Primary database and not the shipping of archivelogs to Standby.
    I believe a lot may have been improved with raster data loading, but you may not be able to control how faster ESRI loads the data (e.g. load parameters etc) if they are hard-coded in the tool (you need to check this). For instance, using ArcSDE, the spead of loading with ArcCatalog may not be the same with ArcToolbox.
    The speed of loading to the Primary database is key, but another focus point will be the number of archvielogs generated in the process thereby using a lot of resource and network to ship the archives. Oracle will ship archive to standby using available network speed. You also need to be careful with the size of each archivelog.

  • Sql time to util date

    hi mates
    can any one give me the java code to convert sql time to util date?
    thanks in advance

    Since java.sql.Time extends java.util.Date it is a
    Date. Am i right here?How about looking it up? Then you'd know.
    Yes, sql.Date extends util.Date.Sorry. I'm getting screen-tired. sql.Time extends util.Date, too. But they only show the time, no date.

  • Converting EPOCH time stamp to time stamp in Oracle

    Hi,
    I need a help regarding how to convert the epoch Time stamp, to oracle date and time format.
    for example,
    for epoch time stamp:1204104116656
    the time stamp should be :2008-02-13 12:43:00.351
    Thanks in Advance
    Basil Abraham

    Are you sure you've got the right timestamp? Assuming this is a standard unix epoch time stamp with the epoch date starting at 1970-01-01 UTC the interval between 1970-01-01 UTC and 2008-02-13 is 13922 days, but your epoch timestamp divided by the number of miliseconds in a day 1204104116656/(1000*60*60*24) comes out to 13936.390... days a difference of 14 days 9 hours 21 minutes 56 seconds and 656 miliseconds.
    Anyway to convert you need to convert your epoch date into an interval and add it to the starting epoch date (as a timestamp):
    select to_timestamp_tz('1970-01-01 utc', 'yyyy-mm-dd tzr')+
           numtodsinterval(1204104116656/1000,'second') dstamp
    from dual;Message was edited by:
    Sentinel

  • How to convert epoch time to datetime in sql*loader Oracle

    Hello,
    I wan't to question how to convert epoch time to datetime in sql*loader Oracle. I try this script for convert epoch time to datetime in sql*loader, but error:
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    This is my loader:
    LOAD DATA INFILE 'C:\Documents and Settings\Administrator\My Documents\XL_EXTRACT_211\load.csv'
    into table TEMP_TEST_LANGY append
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    DATADATA CHAR "TO_DATE('01-JAN-1970','DD-MON-YYYY')+:datadata/86400"
    This is my csv file:
    79314313.7066667
    79314336.2933333
    79314214.3466667
    This is my table:
    CREATE TABLE TEMP_TEST_LANGY
    DATADATA DATE
    Thanks
    Edited by: xoops on Sep 21, 2011 8:56 AM
    Edited by: xoops on Sep 21, 2011 8:58 AM

    thanks for your answer, but I asked to use sql loader instead of the external table, which so my question is why can not the epochtime converted to datetime, if there is no way to convert a datetime epochtime using sql loader, so I'm required to use the external table. thank you.
    This is my error log:
    Column Name Position Len Term Encl Datatype
    DATADATA FIRST * , CHARACTER
    SQL string for column : "TO_DATE('1-Jan-1970 00:00:00','dd-MM-YYYY hh24:mi:ss') + (:DATADATA/60/60/24)"
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Edited by: xoops on Sep 21, 2011 12:33 PM

  • Converting numeric date (seconds) to Oracle date

    Hello all,
    Not sure if this is the correct place for my question but here goes...
    I am extracting data from an Oracle table in which the date/time is stored as a number (seconds since 1970). How can I convert this to an Oracle recognized date? I tried to extract the date as a number and then convert it using the localtime function in PERL but ran into other problems. Any help or advice would be greatly appreciated.
    David

    Instead of writing PERL script if you write on a format trigger same coad (using Pl/SQL) it will work.

Maybe you are looking for

  • How do I install an older version of an app from the Mac App Store?

    I have an older MacBook (OS X 10.6.8) and I can't install most apps. On iOS it will install the newest compatable app. Is there a way to do something like that on a Mac?

  • Problems with certain websites

    I have BB  8830 worldphone.  I am having problems accessing certain websites.   Have Verizon wireless as carrier.  Using opera mini i cant log into a lot of credit card accounts or the verizon log on screens.  What settings should I be using on my ph

  • Change Management Process

    Is it possible within the Change Management process to get the status field to pick up Approved? At the moment it seems to realise when its been completed or declined/failed but other then that always seems to sit as In Progress. I have added the app

  • Will not sync my phone or i pod after last update

    Will not start sync when I connect my I-phone or I-pod since last update a few days ago.

  • Track Select Forward Tool / Track Select Backward Tool

    I'm an regular Premiere Pro user doing more work in Audition these days.  One tool I can't find in Audition that I really miss from Premiere Pro is the Track Select Forward Tool / Track Select Backward Tool.  Is there something like this in Audtion?