convert to date

Suppose that A (col1 number) stored data 1222174057171.
Basically, this is Java. actually the date converted to number and stored in table.i want to convert in date.so how this is possible.

If it's a [Java Date | http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Date.html] then I would say to the milliseconds since January 1, 1970:

SQL> alter session set nls_date_format = 'RRRR-MM-DD HH24:MI:SS';

Session altered.

SQL> SELECT DATE '1970-01-01' + NUMTODSINTERVAL(1222174057171/1000,'SECOND') dt
  2  FROM   dual;

DT
-------------------
2008-09-23 12:47:37

SQL>

or in PL/SQL:

SQL> DECLARE
  2     k_jdate_start CONSTANT DATE := DATE '1970-01-01';
  3     k_jtimestamp_start CONSTANT TIMESTAMP := TIMESTAMP '1970-01-01 00:00:00';
  4
  5     v_numericdate INTEGER := 1222174057171;
  6
  7     v_date        DATE;
  8     v_timestamp   TIMESTAMP;
  9  BEGIN
 10     v_date := k_jdate_start + NUMTODSINTERVAL(v_numericdate/1000,'SECOND');
 11     v_timestamp := k_jtimestamp_start + NUMTODSINTERVAL(v_numericdate/1000,'SECOND');
 12
 13     DBMS_OUTPUT.PUT_LINE('Date:      ' || v_date);
 14     DBMS_OUTPUT.PUT_LINE('Timestamp: ' || v_timestamp);
 15  END;
 16  /
Date:      2008-09-23 12:47:37
Timestamp: 23-SEP-08 12.47.37.171000

PL/SQL procedure successfully completed.

Edited by: William Robertson 26 Sep, 2008 07:21

Tags: Database

Similar Questions

  • Convert binary data into data across the

    Hello

    If I got DAQmx Read.VI binary data (analog 2D I16 Nchan Nsamp), how can I convert these data to scale?

    Best,

    Jay

    See if that makes sense. There is probably a property for the number of bits A/d has, but I he can't think right now and can't spend toom much search time.

  • How to convert the date in milliseconds?

    Hi all

    Can I know how to convert the date in milliseconds?

    My current datetime like this Formate

    QDateTime::currentDateTime (m:System.NET.SocketAddress.ToString ("MMMM dd, yyyy HH"))

    Seconds since January 1, 1970

    http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toTime_t

    Sinds milliseconds January 1, 1970

    http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toMSecsSinceEpoch

  • Convert a Date Format data in a different Format of Date

    I'm trying to convert a date field (Text1-29), which is in the format "yyyy/mm/dd", and move it to the data in another field (text-DOB), which is in the format "mmmm dd, yyyy'."

    I tried various methods, such as the following, but without success. Any suggestions?

    getField("Text-DOB").value = util.scand ("mmmm dd, yyyy", (getField("Text1-29").value);)

    To reformat a date string, first convert the string into a JavaScript date object and and then format this date object as needed.

    Console.Show (); Console.clear();
    Disable the default result field
    Event.value = ";
    get the string from the date of entry
    var sText1_29 = this.getField('Text1-29').value;
    process if there is data
    If (sText1_29.toString ()! = ") {}
    Console.println ("sText1_29:" + sText1_29);
    convert JavaScript Date object
    var oText1_29 = util.scand ("yyyy/mm/dd ', sText1_29");
    Console.println ("oText1_29:" + oText1_29);
    convert the object date JS to the new format
    var sDOB = util.printd ("mmmm dd, yyyy', oText1_29");
    Console.println ("sDOB:" + sDOB);
    Event.Value = sDOB;
    }

  • tool to convert the data to a script

    I have a list of posts with the following data
    EmpNo, name, date of birth
    12345, kala, August 25, 1960
    23456, anugraha, 05-mar-1991
    34567, marie agegee, July 1, 1984

    I want to send this data to another area where the staffing table exists with the same structure.
    That's why I need script like the following file

    Insert in the values of staff (12345, "kala", August 25, 1960 "");
    Insert in the values of staff (23456, 'anugraha','05 - mar - 1991 "");
    Insert in the values of staff (34567, "marie agegee", July 1, 1984 ');

    I can run this script to load data into this new personal table under different domain.

    Transaction every day, I want to create this script file and store it in different domain.

    Y at - it a facility to convert my data as above the script file instead of write procedures using cursors.

    In Oracle SQL Developer, you can right-click on a table and export data as INSERT queries, among other formats.

    Thank you

    -Scott-

    http://sumnertechnologies.com/
    http://spendolini.blogspot.com/

  • How to convert string data from the serial port to double?

    Hello!

    I am very new in LabView and attempt to read data from an OHAUS pioneer pa-313 electronic scale via RS232 serial port. I use the VISA. I can read the data and see it as a string to the screen, but when I try to convert it to a double, it is just the integer and decimal numbers have disappeared. Here's the question: what can be the problem? How can I get the decimals as well?

    What is your normal decimal point?. or?

  • How to convert binary data from the Panel controls in ASCII values?

    Hello

    I seemed to face a roadblock with how to convert binary values in ascii.

    I created this .vi to save all control values in an .ini file and call them at that time where I will carry out the .vi as shown in the file attached. Registration key to simply save the data and Cancel button discards all current changes.

    I would like to understand how to retrieve all the values of control to ASCII, so I assign to a global variable for later use. I've looked everywhere for a good reference document, and I couldn't find one that would explain my question. I would be greatly appreciated if someone could point me in the right direction.

    Thank you

    Sam

    I tried a simple way to save control values in the front panel

    Not reinventing the wheel, when there are ready to use of solutions, for example:

    http://sine.NI.com/NIPs/CDs/view/p/lang/en/NID/209753

    Use the MGI save & restore settings VI of the palette (for example, it records all the settings that have been changed in a graph, which is very useful) and the MGI Save (restoration) Front Panel data live (to save and restore control values in the front panel).

    Here is an example:

  • Convert the date in milliseconds

    Hello

    I am trying to write a function to create an event on the calendar

    the function takes at the beginning of the year, month, day and time. Also the end time

    EventList eventList = (EventList) PIM.getInstance () .openPIMList (PIM. EVENT_LIST, PIM. WRITE_ONLY);
    Event e = eventList.createEvent ();
    e.addString (Event.SUMMARY, PIMItem.ATTR_NONE, "The Gym");
    e.addString (Event.LOCATION, PIMItem.ATTR_NONE, "Gym");

    dates back to January 1, 1970
    e.addDate (Event.START, PIMItem.ATTR_NONE, startDate);
    e.addDate (Event.END, PIMItem.ATTR_NONE, endDate);

    I'm stuck trying to figure out how to convert, say, an entry 2013 (year), 3 (months), 7 (day) in millisecond so that I can

    Put it in the field hiring date

    Thank you

    2 options:

    (1) use a Calednar object, use the methods of 'set' associated with it to set the year, month, day, etc. (not to mention the January is month 0) and then get the Date in that and then the time from the Date.

    (2) format your date so that it is acceptable to HttpDateParser and the race that against your date string.

  • convert the data to array of bytes of screenshot?

    Hello

    I'm capture the screenshot of the screen of the device as bitmap data. Can I convert it to a byte array?

    Please help me through this.

    Thanks in advance

    in my knowledge base, I found a link to a similar question:
    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=736

    I did not try the search for forums - have you?

  • How to convert binary data NVARCHAR2?

    Hi all

    I have binary data in the database (RAW oracle data type). I know that these data contain string encoded in UTF8. Our database runs in WE8ISO8859P15 encoding, UTF8 national character set. Then I would just convert the binary data NVARCHAR2. How can I do?

    I found the UTL_RAW function. CAST_TO_NVARCHAR2. However, this function takes only binary data as a parameter, so I highly doubt that it will work as I hope without specification of source character set...

    Someone has an idea?

    UTL_I18N. RAW_TO_NCHAR ( , "AL32UTF8")

  • How to convert raw data from files (not CameraRaw) of the lot?

    Hello

    I have a number of files that are images of raw data, which means that each has a header of a certain length, containing some info readable on the dimensions height/width, the bit depth and then only the data on the color of each pixel.

    CameraRaw does not open them directly, but they are rather loaded in Photoshop with a dedicated loading menu options.

    I can open one by one after extension *.raw which apply to them and typing height, width, depth and size header in loading options menu that opens, but I would like to know how to batch convert them rather than having to do this process for each of them.

    Of unfortunately Photoshop batch processing does not seem to be able to their treatment on its own, I guess that's maybe because they do not have the usual software-readable RAW headers found in several treaties formats.

    Thank you

    Alfred

    You may be able to write a Photoshop script to do this.  Script can access your files from file systems.  For example, a Script could rename a file to Name.RAW.  Then open Name.RAW in Photoshop with the logon options.    However, I do not know for sure there and options open to the adobe open raw file object.  You need to do this, read the script.

  • Number of days since 31/12/1979 converting a date value?

    Hi all

    I'm not an expert in oracle sql and I hope that someone could help me.  A column of a table is titled BHS_KDTE_SEQU.  This column has 111616 lines and the values stored in these areas are the number of days since 31/12/1979.

    When I write a select statement, how can I convert to get the date value since 31/12/1979 instead of the number of days?

    Thank you in advance!

    Hello

    f429ff94-4133-48E0-AE1C-afcb148d3c2f wrote:

    Hi all

    I'm not an expert in oracle sql and I hope that someone could help me.  A column in a table is called BHS_KDTE_SEQU.  This column has 111616 lines and the values stored in these areas are the number of days since 31/12/1979.

    When I write a select statement, how can I convert to get the date value since 31/12/1979 instead of the number of days?

    Thank you in advance!

    Then

    1 means January 1, 1980,

    2 means January 2, 1980,

    ...

    31 January 31, 1980, means

    32 means February 1, 1980.

    ...

    366 means December 1, 1980,

    367 means January 1, 1981,

    and so on?

    Here's one way:

    SELECT DATE ' 1979-12-31' + bhs_kdte_sequ AS dt

    TABLE;

    When you add a DATE d and a NUMBER n in Oracle, the result is the DATE n days after days.

    I hope that answers your question.

    If not, post a small example of data (CREATE TABLE and INSERT statements) and the exact results you want from these data.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

  • convert the data-> layer mask vertex position position

    I have 2 videos (A; (B) whose corresponding value of markers, I need to distort the video so the position of the markers would correspond to the position of the corresponding markers in video B.

    The markers are easy to spot, but I can only request data followed the anchor layer,

    while I can use for the distortion (Reshape, revision deform or Morph) the tools work with masks.

    I need a way to convert the caterpillars position data to control individual mask points.

    Someone knows or can write this script?

    much help appreciated

    Yes, as David said, with local Tracker2Mask mode, you can move individual points mask with track points of the tracker item AE.

    See this tutorial:

    Tracker2Mask - advanced functions and local change mask | mamoworld

    My MaskTrackerPlus not help not in this particular case, since he cannot move together masks, but individual vertices not independently.

  • help convert the date please

    I have 3 possible length Dates stored in a field of VARCHAR2 type, I'm trying to convert that to a friend:

    We are looking for this as a Date or a numeric field, or both in the end (this is what is needed)

    YYYYMMDD 20110829

    what I have is these different type of length on the ground:

    8

    13/07/13

    9

    30/06/2012

    10

    13/10/2011

    Can someone help me convert this field is number: 20120512 or Date YYYYMMDD? the two examples would help too:-) learning

    You can use the below to find the problem dates to your table. SELECT must of course be updated with your table/column names

    CREATE OR REPLACE FUNCTION dateconvert(p_chardate  VARCHAR2)
    RETURN VARCHAR2
    AS
      v_date  DATE;
    BEGIN
      v_date := TO_DATE(p_chardate, 'MM/DD/RR');
    
      RETURN 'OK';
    EXCEPTION
      WHEN OTHERS THEN
        RETURN   p_chardate;
    END;
    
    SELECT datecol
    FROM   datetable
    WHERE dateconvert(datecol) != 'OK';
    
  • convert the data in the Format of Date imported from MS SQL Server.

    I imported data from MS SQL Server. The column 'Date' received in digital format as 41017.6361109954. How can I convert Date in Oracle SQL.

    If I import the same data in Excel and you change the Type of column to this day. He passes. But in Oracle, I tried the To_Date function with different parameters, but it did not work.

    Published by: XAVER 22 April 2012 02:31
    select timestamp '1970-01-01 00:00:00' + numtodsinterval(41017.6361109954,'day') from dual;
    
    TIMESTAMP'1970-01-0100:00:00'+NUMTODSINTERVAL(41017.6361109954,'DAY')
    ---------------------------------------------------------------------------
    20-APR-82 03.15.59.990002560 PM
    
    SQL> 
    

    SY.

Maybe you are looking for

  • After being invited to the last version, I clicked to move forward. Seems to work but still old version here. I keep getting asked to upgrade

    Firefox Version: 7.0.1 Mozilla Firefox with toolbar AOL - 1.4Keep get informed that I should upgrade to the most secure version (I think it of 8.x and have done and waited for Firefox restart.) However, when it does, it still shows 7.0.1 and later I

  • Windows 8.1 / Bootcamp: no driver

    Running the master El, Bootcamp Windows 8.1 Pro 6.0.1. I installed successfully Windows Pro 8.1 with bootcamp. However, once I have start on Windows, there are so many missing drivers, including Wifi, so I can't do anything. Am I missing something? B

  • How can I get my mail?

    Help!  I get mail, but cannot access it.  I have now more than 700 pieces of mail.  I get daily mail and it keep piling up.  I am in Yahoo Mail and the folder file occupies the entire screen and I tried to slide the side more and nothing happens.  My

  • Glitch screen after installation of the graphics driver on HP G60-120US laptop.

    I recently did a clean install of Windows 7 Ultimate on this laptop, and I have downloaded all the drivers provided on the site. After installing the video driver a more specific sp45230.exe, I couldn't help but notice that the screen is subsequently

  • PowerEdge 4600 2008 installation server

    Hi there try to install Windows server 2008 Enterprise 32-bit Edition. It cannot detect any SCSI drives and told to put on a cd with the driver on it. the list of SCSI drivers is great SCSI hard drive (8) No SCSI RAID (4) SCSI RAID (8) Which of these