Number to a datetime format

I am trying to convert a number and a date field to a date time field and I am having issues.
COl1 COl2
11/23/2005 90359
12/31/2005 123456
02/03/2006 234534
I want my output as
11/23/2005 9:03:59
12/31/2005 12:34:56
02/03/2006 23:45:34
Please let me know...

Or
michaels>  with t as
     (select '11/23/2005' col1, '90359' col2 from dual union all
      select '12/31/2005', '123456' col2 from dual union all
      select '02/03/2006', '234534' col2 from dual)
select to_char(to_date(col1 || lpad(col2,6,0),'MM/DD/RRRRHH24MISS'),'MM/DD/RRRR HH24:MI:SS') x
  from t
X                 
11/23/2005 09:03:59
12/31/2005 12:34:56
02/03/2006 23:45:34Leave away the final formating TO_CHAR() if you really want a true »datetime« format!
Message was edited by:
michaels

Similar Messages

  • How To Get Only Month or Only Year from datetime format of yyyy-mm-dd

    Hi SQL gurus,
    I have field has datetime format of yyyy-mm-dd (ie. 2014-11-28).  Could anyone please educate me on how to extract only month (ie. November but not 11) and only year (ie, 2014) from 2014-11-28.  I writing two report have title of Number of
    sick leaves on November  and Number of sick leaves in 2014.  I am planning to extact 11 from 2014-11-28 and display as November on report title and the same goes for 2014.  Unless you have better non complicated way.   Thank you
    very much in advance.  DingDong!!

    There are multiple ways
    Month name
    SELECT DATENAME(mm,@DateParam)
    SELECT FORMAT(@DateParam,'MMMM')
    Year
    SELECT FORMAT(@DateParam,'yyyy')
    SELECT DATEPART(yy,@DateParam)
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • My iPhone isn't directing me properly to messages since I moved to the UK from Canada.  When I receive a new iMessage it opens a 'new message' thread to their number in a UK format rather than directing me to the established thread under their name.

    I moved to the UK a week ago and popped a new SIM in my unlocked iPhone 4 (all the latest software installed, 6.1.3, though I see in the drop-down below that there's a .4?  My phone says it is up to date anyway).  Since then, I have done a lot of texting to people back home in Canada.  Of course, for economical reasons, I am using iMessage.  When I'm talking to them, if I have messages open, and my screen hasn't gone to sleep, then I'm fine. But if the screen goes to sleep or I'm doing something else and I try to reply by way of any sort of notification where the phone redirects me to the message (when I tap a banner or unlock while an alert is showing), instead of sending me to where I can reply, it starts a whole new text message with the person's phone number in a UK format instead of their contact name.  Their message is in the iMessage conversation history where it belongs, but I can't read it in full until I cancel the 'New Message' and open their conversation in the Messages list.
    So far, I have tried:
    -Simple things like restarting my phone, resetting it, etc.
    -Changing the format of their number to include country code, to not include country code, to have the plus, to not have it, etc.
    -Changing where my messages come from, be it my phone number or my iCloud, etc.
    -Updating iCloud to make sure it knows I'm in the UK.
    -Resetting everything in the reset menu one at a time (I had hopes for settings and the Location & Privacy ones, but no). 
    -Erasing all content and settings and restoring my phone from a backup.
    I've pretty much messed with every setting, but please let me know any suggestions you have, I may have missed one.
    It does seem as if the format of my contacts has something to do with it, because I don't get a notification at all if I change the setting "Show iMessage Alerts From" to contacts only.  The iMessage goes through to the iMessage conversation, but the alerts I get seem to think it's a text message as it comes through with a sample of the message in the alert under their phone number.  It's only when I try to reply through an alert that it screws up.  I know this may seem small but it's driving me nuts, especially because I don't memorize people's phone numbers anymore so I don't know who sent the message until I exit the new message and look it up!
    Please help me before I go mad!

    I moved to the UK a week ago and popped a new SIM in my unlocked iPhone 4 (all the latest software installed, 6.1.3, though I see in the drop-down below that there's a .4?  My phone says it is up to date anyway).  Since then, I have done a lot of texting to people back home in Canada.  Of course, for economical reasons, I am using iMessage.  When I'm talking to them, if I have messages open, and my screen hasn't gone to sleep, then I'm fine. But if the screen goes to sleep or I'm doing something else and I try to reply by way of any sort of notification where the phone redirects me to the message (when I tap a banner or unlock while an alert is showing), instead of sending me to where I can reply, it starts a whole new text message with the person's phone number in a UK format instead of their contact name.  Their message is in the iMessage conversation history where it belongs, but I can't read it in full until I cancel the 'New Message' and open their conversation in the Messages list.
    So far, I have tried:
    -Simple things like restarting my phone, resetting it, etc.
    -Changing the format of their number to include country code, to not include country code, to have the plus, to not have it, etc.
    -Changing where my messages come from, be it my phone number or my iCloud, etc.
    -Updating iCloud to make sure it knows I'm in the UK.
    -Resetting everything in the reset menu one at a time (I had hopes for settings and the Location & Privacy ones, but no). 
    -Erasing all content and settings and restoring my phone from a backup.
    I've pretty much messed with every setting, but please let me know any suggestions you have, I may have missed one.
    It does seem as if the format of my contacts has something to do with it, because I don't get a notification at all if I change the setting "Show iMessage Alerts From" to contacts only.  The iMessage goes through to the iMessage conversation, but the alerts I get seem to think it's a text message as it comes through with a sample of the message in the alert under their phone number.  It's only when I try to reply through an alert that it screws up.  I know this may seem small but it's driving me nuts, especially because I don't memorize people's phone numbers anymore so I don't know who sent the message until I exit the new message and look it up!
    Please help me before I go mad!

  • Migration Issues from Informix to Oracle (datetime format)

    Hello, i am performing a Migration from Informix to Oracle, drive by Migration Workbench, i have an error migrating data from datetime and date fields. I suppose its related by datetime and date format, cause the error tells "Incorrect day or month" when i am migrating data from informix. Targets Oracle database date format is DD/MM/YYYY and source`s Informix database date format like MM/DD/YYYY. Is there any way, in OMW, to specify the mask of datetime or date format to convert date strings from informix to oracle format? Or have i got migrate offline and modify control file to do that with sql*loader?
    How can i do that?
    Example, especify to_date('....', 'MM/DD/YYYY H24:MI:SS') format for migrating informix datetime fields to Oracle.

    The problem i have is, several tables witch contains date and datetime fields, at the same table in informix, by migrating drive by omwb to oracle, the date format i receive from informix at reading is DD/MM/YYYY and datetime format receiving is HH24:MI:SS. Migrating date and datetime types from informix to date, both types to date in oracle, i get an error while matching DD = HH24, MM = MI and YYYY = SS where nls_date_format is DD/MM/YYYY and, the same error matching HH24 = DD, MI = MM and SS = YYYY when nls_date_format is HH24:MI:SS.
    If i set nls_date_format as "DD/MM/YYYY HH24:MI:SS" i get the same error, cause reading data from informix results in data format "DD/MM/YYYY" for date fields and "HH24:MI:SS" for datetime fields.
    I have more than 200 tables in informix with this problem to migrate to oracle, i can solve by migrating offline, modifying datacontrol file to casting to_date format, but over 200 tables, 200 datacontrol files... is there any way for solving that by online migration in omwb?

  • Xsd datetime format

    Hi, I'm using a javascript popup calendar on a web page which can return a timestamp in either of 3 formats (i can choose whichever):
    dd-mm-yyyy hh:mm:ss
    mm/dd/yyyy hh:mm:ss
    yyyy-mm-dd hh:mm:ss
    I want to convert this form value into the xsd datetime format yyyy-MM-ddThh:mm:ss.
    How can I do this?
    I have been using the following code, but this just deals with today's date. I need to alter it so that it can deal with the value from the popup calendar:
    Calendar calendar = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
    StringBuffer sb = new StringBuffer( sdf.format(calendar.getTime()) );

    There is no piece ion your code which would set any value.
    Check the API for Calendar, it has many useful methods.

  • Need help in datetime format.

    hi there,
    currently, i have problem in converting datetime format into this pattern (yyyy-MM-dd).
    I could able to convert it in JSTL which is
    <c:set var="dates"><fmt:formatDate value="${now}" type="DATE" pattern="yyyy-MM-dd"/></c:set>
    <sql:query var="countLeave"
         sql =" SELECT * FROM VCST_EMPLOYEE_LEAVE WHERE CAST(FLOOR(CAST(leave_from AS FLOAT))AS DATETIME) = ? ">
              <sql:param value="${dates}"/>
         </sql:query>
    From the JSTL code above i would like to convert in Java code. I have no idea on how to convert it especially not converting the datetime datatype from MSSQL into String format.
    Is there any way of doing it. Thank you.

    try this
    // Format the current time.
    java.text.SimpleDateFormat formatter
    = new java.text.SimpleDateFormat ("yyyy-MM-dd");
    java.util.Date currentTime_1 = new java.util.Date();
    String dateString = formatter.format(currentTime_1);

  • POI HSSFWorkbook using to read data of datetime format

    Hi
    I am trying to read the drata from excel sheet which contain data as in date format.
    The data is in the datetime format but I am unable to read this data in our jsp page.
    its shows the cell type is of integer type.
    able to read simple date in format yyyy/mm/dd but getting problem in yyyy/mm/dd hh mm format.
    guide me what to to.
    Thanks
    parveen kumar

    Hi
    I am trying to read the drata from excel sheet which contain data as in date format.
    The data is in the datetime format but I am unable to read this data in our jsp page.
    its shows the cell type is of integer type.
    able to read simple date in format yyyy/mm/dd but getting problem in yyyy/mm/dd hh mm format.
    guide me what to to.
    Thanks
    parveen kumar

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • Trouble with SQL datetime format

    I have written a VI to import a CSV file into a SQL data table but I
    cannot get it to work when using a table with "datetime" data
    format.  It will import into a new table with undefined data
    formats as "varchar" format but no luck when going into a table with the "datetime" data
    format.   I need the datetime format for date/time queries later.
    I have attached a zip file of my VI and the CSV file.  Is there a problem with my CSV format or I am I doing
    something else wrong here?
    Please help.
    Thanks,
    Greg
    Attachments:
    SQL issue.zip ‏54 KB

    Greg
    I have just tried to insert your data into a SQL Server (MSDE) database.
    I found that the INSERT data didn't work. The TRUE for Create Table didn't seem to do any thing. So I created a table using labview like this
    And this is its design.
    I then run the vi again and it starts to work with no issues. So it looks like the Create Table?=TRUE for the INSERT doesn't seem to work on SQL Server. It looks like you need to create the table first.
    Here is your data in the database
    Let me know what you think
    David
    Message Edited by David Crawford on 04-28-2006 11:17 AM
    Attachments:
    Your Data.jpg ‏32 KB
    Create Table.jpg ‏20 KB
    Table Design.jpg ‏15 KB

  • Datetime format - auto colon entering in the time

    In Oracle 6i, the user could enter the date and time without entering a colon, and the colon would automatically populate. In Oracle 10g, this no longer is the case.
    Example:
    datetime format: MM/DD/RR HH24:MI
    User enters: 11/01/07 1900
    In 6i, it would put in the colon. In 10g, it responds with an error. If I use format MM/DD/YY HH24:MI, it puts in a colon, but saves the data as 11/01/0007 19:00.
    Is there a workaround? I found a related document in Metalink (Customer Tar # (Mandatory for Customer Bugs):5711214.992 ), but the workaround did not work.

    A format mask of MM/DD/YY HH24:MI is supposed to give you a year of 0007. RR is the one that has some built-in smarts: >50 gives you 19YY and <=50 gives you 20YY. The recommended format mask is to use four Y's: MM/DD/YYYY HH24:MI You basically force the users to be specific.<BR>
    If there was one lesson we should have all learned from the millennium bug, it was that a year should always be expressed in full. Am I right?<br>
    Can you please try MM/DD/YYYY HH24:MI and tell us what happens?

  • In fact it's about mac:excel, how convert in a cell a number written in text format into a value?

    in fact it's about mac:excel8 or 11 in OSX10.7.4,
    how convert in a cell a number written in text format into its value?
    cheers francois

    Hi francois,
    If I copyone of them and do a past special/value, it does not work.
    Try just Paste instead of Paste Special > Value
    I know your question is about Excel, but this works in Numbers:
    Copy 1 234 567 (with spaces) and Paste (not Paste Special) into a Cell in a Numbers Table. The result is 1234567 and it behaves as a number. A formula will consider it to be a number:
    You asked Wayne: what do you mean by "to reference a cell" ??
    The reference is from Cell A2 to Cell A1 through a formula, such as: =A1+1
    Regards,
    Ian.

  • Need profile option for determining DateTime format in Oracle Forms

    Hello All,
    I also have requirement where I need to read the date format in which Oracle Forms displays date values.
    As per updates to [this thread|https://forums.oracle.com/forums/thread.jspa?messageID=10285119] , I just need to read the profile option "ICX: Date format mask" ("ICX_DATE_FORMAT_MASK"), and reformat the date value to my required target format.
    This is good for the date type of fields. But what about the profile option that determines "datetime" formats in Oracle Forms ?
    Appreciate any help.
    Thanks
    Bhaskar

    Are you linking the host script to fndcpesr? E.g.:
    Host script defined with prog extension:
    XXSCRIPT.prog
    Move it to relevant dir:
    $XX_TOP/bin
    Create a soft link to fndcpesr
    ln -s $FND_TOP/bin/fndcpesr XXSCRIPT

  • DateTime format comparison in OSB

    Hi All,
    I have a requirement where I need to compare two time-stamps coming in dateTime format. Do we have any out of the box Xquery functions that would help in this case? If no, then what would be the best way to achieve this? We are using OSB 11g
    Any hints towards it would be appreciated.
    Thanks,
    Harsh
    Edited by: HK^ on Jun 15, 2012 3:22 AM

    Direct comparison does work. Put a xs:dateTime around your dates to be sure.
    For ex.
    xs:dateTime($var1) > xs:dateTime($var2)
    or
    xs:dateTime($body//*:DateA) > xs:dateTime($body/*:DateB)

  • Invalid datetime format with odbc connection (VBA, Excel)

    Hello!
    I try to use QueryTable to extract data from the oracle-db.
    Source:
    sConn = "ODBC;DSN=" + odbc_dns + ";"
    Set oQt = tabelle.QueryTables.Add(Connection:=sConn, Destination:=tabelle.Range("a5"), sql:=sSql)
    oQt.Refresh
    As result I get this error message:
    "[Oracle][ODBC] Invalid datetime format"
    Is there any setting I need to do?
    regards
    Pietro

    Select to_char(entrydate,'dd/mm/yyyy) from usertable;Forgot the closing ' after yyyy.

  • Incorrect Timestamp dateTime format: expected YYYY-MM-DDTHH:MM:SS.NNNNNNNNN

    When i insert the data XML data using BPEL Process getting the following exception for date-format
    detail>oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : Exception Description: Incorrect Timestamp dateTime format: [2010-01-01] (expected [YYYY-MM-DDTHH:MM:SS.NNNNNNNNN])</detail>
    </part>
    I have used the following date format and tried all the cases same above error.
    xp20:format-dateTime(../../DocumentHeader/EffectiveDate,'[Y0001]-[M01]-[D01] [h]:[m01]:[s01]')
    xp20:format-dateTime(../../DocumentHeader/EffectiveDate,'[Y0001]-[M01]-[D01]')
    Any idea how to convert Date to date format given error?

    Hi,
    I'm guessing the problem is not with the format, but with the input date...
    What content is coming in your EffectiveDate tag?
    It should be something like this...
    <EffectiveDate>2012-08-06T12:11:01Z</EffectiveDate>
    If the date format is not in ISO 8601, the XPath function won't work...
    Cheers,
    Vlad

Maybe you are looking for