Date incorrect Conversion time

Hi experts,
Need help can't seem to understand why the time is wrong.
Under query 'dte_computation_on_data' is the old function that use to convert the date and put it in the table. Problem is when he come back to the effective date of the hour
is incorrect. Need help. Thank you
SELECT -- THIS HERE IS MY TEST TO REVERT TIME AND DATE ON THE FORMULA OF WITH RESPECT TO THEIR FUNCTION
to_char(TO_DATE('19700101', 'YYYYMMDD')+(tb1.dte_computation_on_data/86400),'MM/DD/YYYY') || ' ' ||
to_char(to_date(mod  (tb1.dte_computation_on_data,86400) ,'sssss'),'hh24:mi:ss ') revert_test,
systimestamp,tb1.dte_computation_on_data
from
( SELECT -- THIS IS THE FORMULA OF THE OLD FUNCTION THEY USE TO CONVERT DATE TO NUMBER AND INSERTED ON THE ROW
    floor((CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) - TO_DATE('19700101', 'YYYYMMDD')) * 86400) dte_computation_on_data
  FROM dual)tb1;

results 
---------------------------------------------------------------------------------------
REVERT_TEST             SYSTIMESTAMP                            DTE_COMPUTATION_ON_DATA
05/19/2011 03:46:18     5/19/2011 11:46:18.005171 AM +08:00     1305776778

If you want the result in your local time instead of UTC, just add the difference using TIMEZONE_HOUR:

select to_char(revert_test, 'MM/DD/YYYY HH24:MI:SS') as revert
,      to_char(now, 'MM/DD/YYYY HH24:MI:SS')         as now
,      dte_computation_on_data                       as comp
,      revert_test - now                             as diff
from
(
SELECT -- THIS HERE IS MY TEST TO REVERT TIME AND DATE ON THE FORMULA OF WITH RESPECT TO THEIR FUNCTION
       to_date(to_char(TO_DATE('19700101', 'YYYYMMDD')+(tb1.dte_computation_on_data/86400),'MM/DD/YYYY') || ' ' ||
         to_char(to_date(mod  (tb1.dte_computation_on_data,86400) ,'sssss'),'hh24:mi:ss'),'MM/DD/YYYY hh24:mi:ss')
         + (EXTRACT(TIMEZONE_HOUR FROM SYSTIMESTAMP) / 24) as revert_test
,      systimestamp as now
,      tb1.dte_computation_on_data
from
( SELECT -- THIS IS THE FORMULA OF THE OLD FUNCTION THEY USE TO CONVERT DATE TO NUMBER AND INSERTED ON THE ROW
    floor((CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) - TO_DATE('19700101', 'YYYYMMDD')) * 86400) dte_computation_on_data
  FROM dual) tb1
)
/

REVERT              NOW                       COMP DIFF
------------------- ------------------- ---------- ---------------------------
05/19/2011 10:01:09 05/19/2011 10:01:09 1305792069 +000000000 00:00:00.522953

Now, there's only the milliseconds left as difference.

Tags: Database

Similar Questions

  • Dynamic Data in Array - time values

    Hello

    It's me again.

    I have read the lines of a lvm-file and save it in a table by using dynamic data type conversion. The first column, I have in the file is at the same time; I wish I had the time as the first column of the table too, but I couldn't find how to do this. I found this thread , but I think that I can not use this way because I read the unique lines and treat...

    The attached picture should show how I mean this. So, is it possible to get the time (from file) as a column in the table?

    Thank you

    mkrtwo

    Hello

    I'm afraid, because most of us never use screws express, you can have a hard time finding someone willing to get acquainted with them to analyze your code.

    My advice is to get rid of the express vi (not just because you'll get more responses ).

    Using the palette file I/O, and then something like string from picture to picture the range of string to convert your data into a 2D array can give just the output that you want.

    Best regards Florian

  • NO 6356 captured data in real time?

    Buenas tardes the comunidad has NEITHER.

    Bueno esta are mi segunda pregunta one NOR photos of Lola gracias por the colaboracion, realmente me colaboraron muchisimo en mi pregunta anterior hasta resolverla.

    Quisiera saber if con tarjeta NI 6356, are el device than hasta el momento estoy operando is can capture data in real time of forma continued, hasta el momento con the the logramos get comunidad ayuda a LABVIEW medio por programa captured datos por 2 minutos consecutive, a una frecuencia muestreo 1 MHz. Adjuntare el programa as estoy manejando hasta el momento , pero me gustaria saber if hay forma Quebec capture the information of manera continued, y poderla stop in el momento deseado, el realmente real programa indico cuanto tiempo pero su limit son 2 minutos mas tiempo types capture a message indicating that sober paso the capacity of memoria interna.

    MUCHAS gracias por su Atención y knew tiempo, igual seguire realizando the tests, TR black find alguna mejora posteare o tr black resolverlo. MUCHAS gracuas a todos espero than me can help.

    Carefully,.

    Andres Saavedra


  • Data in real time to table

    Hi all
    I am trying to create a spreadsheet of the 500 columns and 1000 lines.
    My program consists of real-time data streaming via the com ports (VISA), running in a continuous loop. I was hoping that someone could help me with the following:
    (1) how to convert point-by-point of data in a table format?
    (2) how to put in place the iterations and loops for the program to collect 1000 samples of data and then move to the next column (switching 500 times columns)
    (3) how can I take my array 1000 x 500 and write it to a spreadsheet?

    Most of the examples that I find to create rows and columns of the tables use random number vi, incorporated into the INSIDE of a loop for, and then auto-indexation it. However how I incorporated my data in real-time (within a while loop) in a loop for (that's why I'm unable to follow these examples).

    I'm new to LabView fairy. I would be great if someone could help me because I've tried countless ways to create my spreadsheet.

    Thank you!

    Would be easier to collect the data in a table 1 size d 500000 (= 500 x 1000). Initialize an array 1 d of this size and the correct data type and use it to initialize a shift of you register acquisition loop. With each new data point, use 'replace the subset of table' to replace the actual data based on the final iteration. When the acquisition is done, reshape the array to 500 lines. 1000 columns and write it to the file (using for example write to the spreadsheet file).

    Why do you use a while loop. Apparently, you know the number of iterations before the start of the loop, a loop FOR would be more appropriate (you can view the conditional terminal to stop earlier if necessary)...

    Be aware that it is expensive large format paintings. Unless the ihe file must be imported somewhere else, I recommend using binary files.

  • Taking the average of the data in real time

    Hi all experts!
    I am a new Member in labview. I have a "stupid" question that takes a lot of my time. Please help me.: mansad:
    The problem is that the way to take the average of the data in real time. For examples, firstly take averages of 100 samples and then then wait 100 samples and averaging them and so on...
    In any case, thank you very much! : manhappy:

    Hello

    Maybe this will help you...

    Kind regards...

  • The vi below opens a new data file every time new data of the visa arrived. I only want a single file of data for registration period!

    The vi below opens a new data file every time new data of the visa arrived. I only want a single file of data for registration period!

    Can someone bring me (Labview is new to me) in the right direction?

    John

    See attached the amendment. I made a change to my suggestions and possess the top-level VI for the null refnum. See if it makes sense.

  • How to make the variable data record (intermittent time), with a real-time display

    I'm a complete newbie to Labview. We are currently developing a piece of hardware in the lab to automatically take the readings of the concentration of a sample, through correlations with voltage readings. I have read and worked through the getting started with Labview .pdf, but other than that my knowledge is minimal. I have a flowsheet of work who is able to do it correctly and display and write the data in real time. However, I want to be able to write to a file only every 10 minutes or so, since experiments can run for several days and the amount of data it currently logs is unnecessary.

    Would be nice if he could write it in columns like this:

    [date time]  [voltage ave]  [levels]

    xx                     xx                        xxx

    xx                     xx                        xxx

    xx                     xx                        xxx

    .. .but only once every 10 minutes. Or at any interval of time, I put.

    I tried to connect different parallel loops, but I failed miserably. I don't know if it is a relatively simple problem for you guys to help me with.

    I have attatched file. Please note that the file variables.txt is there simply to hold the settings for the correlation of concentration, which took charge of him.

    In addition, advice or tips to improve this would be greatly appreciated.

    Hi mooray.

    I took a quick look at your code, but you should be able to do something like this:

    When you have an Express VI elapsed time set to 600 seconds (10 minutes). If every 600 seconds time out will pass a Boolean TRUE, which will allow to write the measurement file Express VI. Therefore, what iteration of the while loop, you would write some input comes in the signal input to write it into a file position.

    There are other ways to do this as well, but it's pretty simple. I hope this helps!

    Thanks for choosing National instruments.

    Aaron P

    National Instruments

    Technical sales engineer

    http://www.NI.com/support

  • How display the date and the time in the taskbar on Windows 7 Home Premium 64 bit system?

    How display the date and the time in the taskbar on Windows 7 Home Premium 64 bit system?

    I already did it.  The time is displayed in the correct format, but I can't seem to view the date of

    Any other suggestions?

    Thank you

  • How to recover full date format and time of cursor Variable

    Hi gurus,

    I'm having this 'cable' question.

    When I run this selection (below) of a table (a table with a date data type can be used for testing purposes)

    Select max (crt_heure_entree) in the test.var_table_date MAX_DATE

    MAX_DATE

    -----------------------

    21/12/2015-15:33:57

    When I run inside a PL/SQL block

    Declare

    CRS1 DATE;

    ..

    ...

    Select max (crt_heure_entree) as max_date in crs1 infapp.compte_rendu_traitement;

    dbms_output.put_line ('MAX_DATE... » || TO_DATE (crs1,' DD/MM/YYYY HH24:MI:SS'));)

    ...

    ...

    END;

    I get

    MAX_DATE

    -----------------------

    21/12/2015

    Problem:

    I need to get the full value date and the time to do a select and insert data between call dates and times.

    Because the variable retrieves just the date I have problems of constraint violation.

    Question:

    How can I recover the full date / time format of cursor?

    Thanks if you can help.

    Format before you print using TO_CHAR

    Here is the link for the Format of Date patterns

    https://docs.Oracle.com/CD/B28359_01/server.111/b28286/sql_elements004.htm#CDEHIFJA

  • Create another data base of Liquibase changelog: automatic data type conversion

    I need to convert the structure of PostgreSQL databases to Oracle. In PostgreSQL, I a postgres database.

    In Oracle, I have an empty database in which I want to write to postgres database in PostgreSQL.

    Actually, I didn't need the data, only the structure (relationships).

    For this, I use Liquibase. I get the changelog of PostgreSQL with the command:

    Liquibase.

    -driver = org.postgresql.Driver.

    --classpath="C:\db_drivers\postgresql-9.3-1102.jdbc3.jar------.

    --changeLogFile="./postgresql_changelog.Xml------.

    -url = "" jdbc:postgresql://localhost:5432 / postgres "\"

    -username = schema_name_here.

    -password = *.

    -logLevel = debug.

    -defaultSchemaName = Ms.

    generateChangeLog

    After that, I try to create objects in the Oracle database:


    Liquibase

    -driver oracle.jdbc.OracleDriver =

    --classpath="C:\db_drivers\ojdbc14.jar".

    --changeLogFile="./postgresql_changelog.xml".

    --URL="JDBC:Oracle:thin:@ip_here:orabeta".

    -username = *.

    -password = *.

    Update

    Does not work: ORA-00902

    Here is a fragment of postgresql_changelog.xml:

    ...

    < changeSet author = '(generated) Alexey' id = "1409146335011-53" >

    < create table tableName = "TABLE1A" >

    < column name = "total_pk" type = 'INT8' >

    < forced nullable = "false" / >

    < / column >

    < column name = "form_fk" type = 'INT8' >

    < forced nullable = "false" / >

    < / column >

    ...

    I also generate a pure SQL file:


    Liquibase

    -driver oracle.jdbc.OracleDriver =

    --classpath="C:\db_drivers\ojdbc14.jar".

    --changeLogFile="./postgresql_changelog.xml".

    --URL="JDBC:Oracle:thin:@ip_here:orabeta".

    -username = *.

    -password = *.

    updateSQL > update.sql

    Here is a fragment of update.sql:


    ...

    CREATE THE TABLE SCHEMA_HERE. TABLE1A (total_pk form_fk INT8 INT8 NOT NULL,.. .etc);

    INSERT INTO SCHEMA_HERE. TABLE1A (ID, $form_id,... etc.)

    ...

    I want to generate the file, in which all the data types correspond to the target database, that is to say I want to create. I can write a simple parser that replace the data types, but this isn't the right solution - can be a lot of data.

    It is possible to get changelog from a database and update another database on a different server this changelog RDBMS? I need to get the automatic and Automatic data type conversion generate XML data / SQL output with the data types of target database.

    Or maybe there is an option to generate output data types with "abstract"? That is to say with data types that are not in the actual databases, for example, instead of INT8 - whole, etc.

    I would be very grateful for the information. Thank you all.

    Why not to use pg_dump to extract the schema in a file of script that you can then 'change '?

  • I bought my 2009 year Adobe Creative Suite 4 for Mac OS. Now I have bought me a few weeks ago a new Apple iMac 27-inch with new ElCapitan Workprogram. I turn all my dates with a time machine backup of my old iMac 27. But now I can't start my photosh

    I bought my 2009 year Adobe Creative Suite 4 for Mac OS. Now I have bought me a few weeks ago a new Apple iMac 27-inch with new ElCapitan Workprogram. I turn all my dates with a time machine backup of my old iMac 27. But now I can't start my program of photoshop CS4. The error number is 150:309. Call support, they say. It will be very happy, if you can help me. Best regards from Germany black forest... Your Thomas

    using time machine to restore the adobe programs is problematic.

    at this point, uninstall all done by the time machine to your problematic adobe programs.

    clean through the use of the Adobe Creative Cloud cleaning tool to solve installation problems

    Restart your computer

    well install cs 4 using the installation files and your serial number and activate: How to open third-party developers not identified in Mac OS X applications ' Mac Tips .

    Available downloadable Setup files:

    Download and installation help links Adobe

    Help download and installation to Prodesigntools links can be found on the most linked pages.  They are essential; especially steps 1, 2 and 3.  If you click on a link that does not have these listed steps, open a second window by using the link to Lightroom 3 to see these "important Instructions".

  • DATE in real time format

    Hello

    In the reply of the Disqualification Webservice, all the DATE attributes are joined with timestamp "T00:00:00.000Z."

    Can do us somehow DATE attributes have no not this time stamp? It is originally of the correspondence downstream of siebel systems issues.

    Thank you and best regards,

    Ravi

    Hello

    The attributes of 'DATE' formal in Disqualification are the date and time. If you want dates without the time element, you will need to change the web service (and the data interface) to use a string attribute and convert dates into strings in your process before them by mapping.

    I suggest you simply add a new attribute rather than deleting the existing one.

    Kind regards

    Mike

  • varchar2 to the date format conversion

    I have converted the formats of date several times, but for some reason, I get an error invalid number when you try to convert a varchar2 column. I tried the to_char and to_date function and I get the same result. The column is a date and it is formatted like ME-DD-YYYY, but I want to change it to DD/MM/YYYY. My query is below:

    Select to_date('fccpdate','MM/DD/YYYY')
    of cc_class_scmast_v

    When I try to_date I get this:

    Error from the 1 in the command line:
    Select TO_DATE ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01858: a non-digit character was found here where was waiting for a digital
    01858 00000 - "a non-digit character found here where was waiting for a digital".
    * Cause: Input data to convert using a date format model has been
    incorrect answer. The input data did not contain a number where is a number
    required by the format model.
    * Action: Fix the input data or the date format model to ensure that the
    elements correspond to the number and the type. And then try the operation again.



    When I try to_char I get this:

    Error from the 1 in the command line:
    Select TO_char ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01722: invalid number
    01722 00000 - "invalid number."
    * Cause:
    * Action:


    I tried to remove the single quotes of my column and that does make a difference. Any help is appreciated.

    Hello

    housetiger77 wrote:
    I have converted the formats of date several times, but for some reason, I get an error invalid number when you try to convert a varchar2 column. I tried the to_char and to_date function and I get the same result. The column is a date and it is formatted like ME-DD-YYYY,

    If the column is a DATE, then it has the same format that all DATEs, which is nothing like 'DD-MON-YYYY '. Formats like which apply only to chains.
    Conversely, if it is in the format "DD-MON-YYY", then it is a string, not a DATE.

    but I want to change to DD/MM/YYYY. My query is below:

    Select to_date('fccpdate','MM/DD/YYYY')
    of cc_class_scmast_v

    To_date (x, "MM/DD/YYYY") tries to convert the string x in a DATE. Let's say it starts by taking the first 2 characters of x, for the month. The first 2 characters of 'fccpdate' are "fc", which is not a valid number (at least not in base 10), not to mention a number from 1 to 12, TO_DATE so will raise an error.

    When I try to_date I get this:

    Error from the 1 in the command line:
    Select TO_DATE ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01858: a non-digit character was found here where was waiting for a digital
    01858 00000 - "a non-digit character found here where was waiting for a digital".
    * Cause: Input data to convert using a date format model has been
    incorrect answer. The input data did not contain a number where is a number
    required by the format model.
    * Action: Fix the input data or the date format model to ensure that the
    elements correspond to the number and the type. And then try the operation again.

    When I try to_char I get this:

    Error from the 1 in the command line:
    Select TO_char ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01722: invalid number
    01722 00000 - "invalid number."
    * Cause:
    * Action:

    I tried to remove the single quotes of my column and that does make a difference. Any help is appreciated.

    It's a good first step. Literals are enclosed in single quotes are not identifiers (including the column names). "fccpdate" is the literal string of 8 characters containing 'f', ' c; Another 'c', 'p' 'd', 'a', 't' and 'e'. " fccpdate (without the single quotes) can be the name of a column.

    If fccpdate is a string, as July 18, 2012', then you can convert it to a DATE using TO_DATE.

    TO_DATE (fccpdate, 'DD-MON-YYYY')
    

    If you want to display a DATE in a particular format, use

    TO_CHAR ( d
            , f
            )
    

    where d is a DATE, and f is the format string. In this case, d is perhaps the TO_DATE expression above

    TO_CHAR ( TO_DATE (fccpdate, 'DD-MON-YYYY')
            , 'MM/DD/YYYY'
            )
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

  • reports of conversion time

    Hello

    When we export a column counter usage report date time and time is converted to a number 13-digit

    is it possible to have the conversion algorithm to convert this value to the date and time?

    Concerning

    Daniel

    Hi Daniel,.

    The timestamp format that you see is a time timestamp (specifically a millisecond time timestamp). You can convert timestamps using something like http://www.epochconverter.com, although this is probably not accomplish what you're looking for. You are wanting the reports exported to show the timestamp as hh: mm: MM/DD/YY? If you need to present this as a feature request, but I'll do some tinkering in my lab to see if I can't export to this format.

    EDIT: a few quick searches turned a few posts on the MS forums discuss conversion Epoch timestamps in Excel. This link seems to include a formula that converts the timestamp of the time in an excel-readable format, which can then be converted to a human-readable format by setting the cell a Date/time format.

    http://www.MrExcel.com/Forum/Excel-questions/49217-converting-normal-time-epoch-time-format-using-Excel.html

    I have not tested yet, since the posters in the forum do not specify whether or not timestamps with which they deal are in seconds or milliseconds, then it may require additional conversion to make it work if they deal in seconds with the provided formula.

    EDIT again: I took the formula that they suggested in the link above and it seems to work only on the timestamps that are provided in a few seconds. As the time stamp that we provide is in milliseconds, you need to split the time value of 1000 as a result of the following formula:

    = ((A1/1000)/86400) + 25569

    Where A1 is the cell that contains the time stamp. I have provided a screenshot of this formlua in action below. Let me know if you have any questions. Sorry if all my editing is spamming your e-mail address.

    Final cut (I promise): I pulled a measure of consumption in excel report, to see if it was possible to convert the entire column, and so far the best solution I have found is the following:

    -Insert a new column between #Time and DNS host name (I called him 'Converted time')

    -Select the line below the title and your entry form (B11 in my case)

    -Formula ' = ((A11/1000)/86400) + 25569 "(with additional info at the top of the rerport values time started to A11)

    -Press ENTER to insert the formula

    -Select the cell containing the formula

    -Double click on the box in the lower right of the cell, it will apply the formula to all of the following lines

    -Select the column, and then right-click to open the menu "Format cell".

    -Define the colum 'Time' and select the desired format

    I hope this information was useful!

    -Chris

    Technical Support Engineer | VCP4

    VMware Support Global Services

  • Date format conversion - am/pm

    I want to insert below in a table, the column is type 'DATE '.

    but in the following case which is at 12:00, it removes the time part and returns ony the part date how he converted with a portion of time. (without using 24-hour format)
    See the queries

    SELECT to_date('01/11/2011 11:59:00 am','dd/MM/yyyy hh:mi:ss am')
    OF the double
    Back: 11/01/2011 11:59

    SELECT to_date('01/11/2011 12:00:00 am','dd/MM/yyyy hh:mi:ss am')
    OF the double
    Back: 11/01/2011

    SELECT to_date('01/11/2011 12:01:00 am','dd/MM/yyyy hh:mi:ss am')
    OF the double
    Back: 11/01/2011 12:01:00 AM

    I can get it at the TO_CHAR conversion but there is a problem when inserting a DATE column type?

    SELECT to_char (to_date('01/11/2011 12:00:00 am','dd/MM/yyyy hh:mi:ss am'),' dd/MM/YYYY HH: mi: ss am')
    OF the double

    user483578 wrote:
    Thanks everyone... It was like that... and worked well

    DECLARE
    x varchar2 (50);

    BEGIN

    SELECT to_char (to_date (11 January 2011 12:00 ',' dd/MM/yyyy hh), ' dd/MM/yyyy HH')
    X
    DOUBLE;

    INSERT INTO my VALUES (to_date (x,' dd/MM/yyyy hh));

    END;

    ?

    It's the same what do I do...

    BEGIN
      INSERT INTO ma VALUES(to_date('01/11/2011 12:00:00','dd/MM/yyyy hh:mi:ss'));
    END;
    

    There is no need to convert a string date and then back to a string and then insert this string by converting it back to a date once again.

Maybe you are looking for