Oracle DATE/TIME COMVERSIONS

Hi guys!
This is my second thread about formating a date variable.
The fact is I would like to increment a date variable in an amount of miliseconds, and after that I want to format the date to this way dd/mm/yyyy 24hh:mmi.
An example:
Date Variable Miliseconds to increment Date Resut
3/13/2007 8:17:28 170000 13/03/2007 08:20
I also want to convert an amount of miliseconds to a Time Variable (In this case date Variable) to this way 24hh:mi
An example:
Miliseconds Time Result
170000 00:02
I hope you can help me guys.
Thanks.

Miss read
Milliseconds you can convert to seconds by dividing 1000
SQL> ed
Wrote file afiedt.buf
  1  with t as(
  2     SELECT  to_date('12/12/2007 10:00:00','dd-mm-yyyy HH24:MI:SS') LOCALDATE ,3600000 deltat
  3     FROM   dual
  4         UNION all
  5     SELECT  to_date('10/12/2007 5:00:00','dd-mm-yyyy HH24:MI:SS') LOCALDATE ,7200000 deltat
  6      FROM   dual)
  7  select localdate, deltat/(60*60*1000) hours,
  8         to_char(NUMTODSINTERVAL(deltat/1000,'SECOND')+LOCALDATE, 'dd-mm-yyyy HH:MI')
  9* from t
SQL> /
LOCALDATE      HOURS TO_CHAR(NUMTODSI
12-DEC-07          1 12-12-2007 11:00
10-DEC-07          2 10-12-2007 07:00HTH

Similar Messages

  • Convert Data type from Oracle Data time string to SQL Date time data type

    I have a time stamp column pulled from oracle into a SQL server db table varchar datatype column.
    Now i want to change that column to date time.
    Following is the data present in the table:
    01-APR-11 02.15.00.026000 AM -08:00
    01-APR-11 04.15.00.399000 AM -08:00
    01-APR-11 06.15.00.039000 AM -08:00
    I want to convert this data into sql server datetime data type.
    Please advice.
    Thanks,
    Sam.
    I am unable to find the solution in other sites which is why I have posted it in Oracle forum for seeking solution.
    Thanks in Advance.
    Sam.

    Sam,
    How are you actually loading the data into SQL*Server - are you using something like an Oracle gateway, BCP or another Microsoft utility of some sort ?
    If you are using an Oracle problem then we may be able to help but if using a Microsoft utility then you should really follow up with Microsoft to know what format the data should be in to use a Microsoft utility.
    Regards,
    Mike

  • JDBC / oracle / date & TIME

    I am attempting to insert the date and time into a date-time field in an Orcale DB.  I am currently sending the following data into the field.
    24-AUG-2007 13:45:44
    and i am getting the error...
    Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'VENDOR_HEADER_1000' (structure 'STATEMENTNAME1000'): java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string
    Thanks
    Skip Ford

    Hi Skip Ford,
        Follow these links
    http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetdatefromOracle.htm
    http://ramblingabout.wordpress.com/2007/01/26/remember-date-time-timestamp/
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
    Regards,
    Santosh.

  • Unix Seconds to Oracle Date...HELP !!!

    Hi All
    We got a Oracle (8.1.7) database and I am trying to load some data but one of the column is in Unix time format(seconds since 01-01-1970) and I am trying to convert it to Oracle Date & time (dd-mon-yyyy, hh24:mi:ss) in CST time zone.
    I am using this formula:
    select to_char(new_time(to_date('01011970', 'ddmmyyyy') + 1/24/60/60 * 1090831602, 'GMT', 'CST'), 'dd-Mon-yyyy hh24:mi:ss') "Seconds to Date" from dual;
    But it seems to me that I am getting incorrect results.
    Could someone please help.
    Cheers
    Amit

    hmmm, this is still poor support! new_time does not "know" if we are in winter or in summer.
    select new_time(sysdate, 'GMT', 'EST'), new_time(sysdate + 180, 'GMT', 'EST') from dual
    NEW_TIME(SYSDATE,'G NEW_TIME(SYSDATE+18
    04.08.2004 05:31:59 31.01.2005 05:31:59
    select
      FROM_TZ( CAST(SYSDATE AS TIMESTAMP),'GMT') at time zone 'Europe/Zurich',
      FROM_TZ( CAST(SYSDATE+180 AS TIMESTAMP),'GMT') at time zone 'Europe/Zurich'
    from dual;
    FROM_TZ(CAST(SYSDATEASTIMESTAMP),'GMT')ATT FROM_TZ(CAST(SYSDATE+180ASTIMESTAMP),'GMT'
    04-AUG-04 12.28.15.000000 PM EUROPE/ZURICH 31-JAN-05 11.28.15.000000 AM EUROPE/ZURICH

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

  • Is 000001010000z a valid date time in Oracle?

    Hi,
    When working with Open LDAP connection from Oracle, I need to set and remove the value '000001010000z' for locking and unlocking the user account respectively. This is working fine. However, for some calculation, I need to convert this value as a date value which I couldn't do. Is this a valid date time in Oracle? If so how to convert it as a date value.
    Oracle version: 10g R2
    Thanks,
    Natarajan

    Thanks, Mithun for your answer. We have the same issue, as an user, we can lock an account using the special value, but unable to unlock using the same user. I have reported this to our LDAP administrator.
    Regarding my question using this special value as a date value in oracle, though it is a valid date in the LDAP system, we cannot convert this as a date value in Oracle.
    Natarajan

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

  • Error messages when sending date-time stamp to Oracle Database

      I have a complex application that communicates with an Oracle database.  One of the table values that gets written to the table is a date-time stamp.  Until recently, the user only required a date, and this was never an error. (The format String used was %d-%b-%Y)  Now they need a time-stamp as well, so I attempted to edit the format string input of the format date/time string function to include the time. I have tried numerous format strings, each of which returns an error on execution.  Depending on which format I use, I get one of 3 different error messages.  The really odd thing is that both the date and time always get stored in Oracle without any problem (regardless of what date-time I use, as long as I include the date and any part of a time stamp - I get the entire timestamp even if I only include %I for the hour).  The only issue is that LabVIEW generates an ODBC error if I try to include the time to the date-time stamp.  In other words, teh date/time stamp writes to the Oracle database, but an ODBC error occurs every time.  I've included a word doc with screen captures of the format strings used, the resultant date/time stamps written to Oracle and the error messages generated within LabVIEW. Any advice would be most appreciated.
    Attachments:
    Summary of ODBC Error messages related to date-time stamp.doc ‏65 KB

    Oracle has a standard date format: 12-Mar-2009 that it accepts as a string, but if you want more than that, you need to use the todate() function. I used this string going into the standard LabVIEW ''Format date/time sting vi' 
    to_date('%d-%b-%Y %H:%M:%S', 'DD-MON-YYYY HH24:MIS') to create the value needed for Oracle.
    Then I use standard format string to create SQL: insert into mytable (mydate) values(%s) and select * from my table where mydate = %s using the string above for %s.
    I think you can also define a global format for all time strings but I haven't bothered figuring that out.

  • Location of oracle database crash date time

    Hi,
    After system crash happens and oracle database is recovered from system crash where can i find the entry in oracle which shows the time of system crash?
    I tried the following to get the system crash date and time:
    When i start auditing a user by logon and the user is logged on to system oracle creates an entry in dba_audit_session table for user logontime in TIMESTAMP column, but if the system crashes in between when the user is logged in to the system then no entry is made in LOGOFF_TIME column of dba_audit_session table.
    in followin example orcl user is being audited by logon.
    orcl logsin the system at time 11:36 am and my system crashes.
    when orcl logsin again after instance recovery logoff_time is blank, and shows a new entry of orcl.
    SQL > select username,to_char(timestamp,'dd-mm-yyyy hh:mi:ss'),to_char(logoff_time,'dd-mm-yyyy hh:mi:ss') from dba_audit_session where username like 'TMS' order by timestamp;
    USERNAME TO_CHAR(TIMESTAMP,' TO_CHAR(LOGOFF_TIME
    ORCL 16-10-2012 11:36:16
    ORCL 16-10-2012 11:46:33
    My aim is to get the date & time of database crash.

    Hi;
    As mention here the only way to check alert.log, If Asm avaliable you need also check asmlog and related log files.
    If you have OSwatcher on your system you can also check what process or wha happend on your server too
    PS:Please dont forget to change thread status to answered if it possible when u belive your thread has been answered, it pretend to lose time of other forums user while they are searching open question which is not answered,thanks for understanding
    Regard
    Helios

  • Oracle Database Procedure Execute Date/Time

    Hi,
    Is possible to track the Oracle Database Procedure Execute Date/Time?

    Is possible to track the Oracle Database Procedure Execute Date/Time?Yes, by using
    CONNECT sys/password AS SYSDBA
    AUDIT EXECUTE PROCEDURE BY fireid BY ACCESS;

  • Keep Oracle DATE datatype but insert via PreparedStatement with time

    I know there are alot of messages concerning java.sql.Date and that it doesn't
    hold the time.
    Can you give me an example of how to insert Date and Time into an Oracle
    "DATE" field using preparedStatements?
    dailysun

    java.util.Date d = new java.util.Date();
    java.sql.Timestamp ts = new java.sql.Timestamp(d.getTime());
    prepStatement.setTimestamp(1, ts);

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

  • Oracle Role Creation Date time stamp

    Hi All ,
    Can anyone pls help me to find out the Date time stamp when a Role has been created into database .
    Your early response will be appreciable.
    Many thanks ,

    Hi,
    >>Actually I am searching through google to see the each column name description for sys.user$ but not able to find anything useful
    These base tables are not documented (public) ... It seems that PTIME column stores the time stamp information when the password's user has changed.
    SQL> create user myuser identified by myuser;
    User created.
    SQL> select
      2    name,
      3    to_char(ctime,'dd/mm/yyyy hh24:mi:ss') ctime,
      4    to_char(ptime,'dd/mm/yyyy hh24:mi:ss') ptime
      5  from
      6    user$
      7  where name='MYUSER';
    NAME            CTIME               PTIME
    MYUSER          30/04/2008 10:52:25 30/04/2008 10:52:25
    -- waiting some time ...
    SQL> alter user myuser identified by legatti;
    User altered.
    SQL> select
      2    name,
      3    to_char(ctime,'dd/mm/yyyy hh24:mi:ss') ctime,
      4    to_char(ptime,'dd/mm/yyyy hh24:mi:ss') ptime
      5  from
      6    user$
      7  where name='MYUSER';
    NAME            CTIME               PTIME
    MYUSER          30/04/2008 10:52:25 30/04/2008 10:53:08Cheers
    Legatti

  • Is there any chance that ORacle RDBMS persuades ODBC to consider Oracle Date type as Date without time

    Hello,
    I have complain from SPSS end user reaching Oracle through ODBC interface that Oracle date fields are considered as datetime fields in SPSS.
    It is the whish that SPSS would consider Oracle date field right from the beginning as date field without the need to reformat field...
    In SPSS dictionary field is described as DATETIME20 after query from the database.
    Any idea is apreciated,

    I just double check and didn't see this option anywhere. You can however copy/paste text on a BlackBerry. I believe the only way would be to copy it in your email client and have the BlackBerry synchronize with it
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • DID YOU KNOW?? - ABOUT DATE TIME CONVERTERS??

    Hi All,
    DID YOU KNOW??
    That the Creator IDE provides a set of converters that you can use to convert component data. If your input field is for numbers, then you most likely need a converter. Converters are also good for formatting dates, times, and currency values. The standard converters, which you can use are located in the Converters section of the Components Palette.
    The Date Time Converter
    A Date Time Converter Converts between java.lang.String values in your component properties and data types of java.util.Date. The conversion usually applies to the property of a component used to display values and to pick up values entered by users, such as the text property of a Text Field component.
    An example is binding a JavaServer Faces component to to a database column of type DATE. When you bind a component, the IDE normally identifies the data type for you and sets the appropriate converter when you establish a binding to the value property. However, you can also add this converter manually by setting the component's converter property.
    * Note: If you are using an Oracle database, use the SQL Timestamp converter instead.
    Learn more :-
    JDBC Type Conversions
    http://developers.sun.com/prodtech/javatools/jscreator/reference/docs/help/2update1/connect_data/jdbc_type_conversions.html
    Using Converters
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/converters.html
    We would like to know the following from you :-
    1) Why and How are you using Converters in applications you are building?
    2) Did you face any challenges while using them?
    3) Did you find any cool ways of using these or build any cool custom converters?
    4) Any feedback you might want to share about converters to make it easier in using them.
    Thanks for all your inputs and for joining in the discussion.
    K

    did you know that sqlTimestamp converter returns value of java.sql.Date type if you are using sun's oracle jdbc driver. It will return the correct type if you use oracle's jdbc driver. Not sure why this happen, though. Bug?

Maybe you are looking for

  • Sorting Currency conversion Variables in Query Selection screen

    Hi Experts, I have an issue in sorting variables. A Currency translation is used here which has two selection options here, one for "Currency" and one for "Currency conversion date". They just pop in somewhere in the selection screen with out order.

  • J2EE cannot start  ?

    Hi, Recently, my j2ee enginee cannot start dispacher and j2ee server always in yellow colour (Starting framework forever). This is the error i got from server.log : Thread[SAPEngine_EnquReader,5,main]##0#0#Error#1#com.sap.engine.core.locking.impl3.Lo

  • HRMS API HELP

    Hi Everyone, I need help in writng a pl/sql script(API) to move a thousand employees or more from an old business group to a new business group. I am having a challenge doing this as it does not pick individual employees, What can i include in my API

  • SharePoint 2013 Filter Web Part configure connection webpage blank

    Hi, I've got a problem at one of my clients. I'm trying to connect a filter web part to a document library. I'm configuring a connection and the first pop-up (where you can configure a "Get Parameters From or Get Filter Values from" connection type)

  • PLSQL ERROR. REQUIRED HELP...!!

    Hi, I developed the following code which is throwing PLSQL ERROR. (error is below the code). Pls Help me out. CODE : Declare vRow binary_integer; v_pro_id number; i NUMBER := 1; cursor c1 IS (select BUSINESS_UNIT_ID, OBJECT_TYPE_ID, TASK_ID, CHECKLIS