Date extract format mm/dd/yyyy

Hi,
In db i have date stored like this for a particular record
1112013
How to extract this through a query so that i will get
mm/dd/yyyy format.
Thanks,

user10873676 wrote:
Data is already there in the table.. table datatype is varchar2(20) ...
Now we are unable to retreive data from front end as different formats of date are already present in this table
for some date like 852013 we can get the output as 8/5/2013
for some date like 11122013 we can get the output as 11/12/2013
but now the problem is some dates are of length 7... which is 1112013... in this case i am not able to make out just like said in the above replies whether it is 1st Nov or 11th Jan...
we can make it as a date column and store it in the future in the date formats , but what about the existing ones... may be these have been stored previous or dumped into this table like this.
Is there a way to get these queried and displayed in the front end in a proper way ?
This is a prime example of why dates should be stored in DATE columns.
You need to find the person who 'designed' that table and force them to go through every single ambiguous date and
investigate what it should be - that'll teach them not to make that mistake again!
BTW: even 852013 and 11122012 are ambiguous - how do you know if it is 8-May-2013 or 5-Aug-2013 and 11-Dec-2013 or 12-Nov-2013?

Similar Messages

  • Trasnform current date to format MM/dd/yyyy HH:mm:ss AM/PM

    Hi All,
    How do I transform current date to format MM/dd/yyyy HH:mm:ss AM/PM?
    I am able to get the format MM/dd/yyyy HH:mm:ss by using the standard date function. How do I get AM or PM to end of MM/dd/yyyy HH:mm:ss??
    Thanx
    Navin

    Hi Navin,
    How AM/PM is added? In the sample values given its in 24 hrs notation. Are u sure you want to add AM/PM to this notation? or U want to change this 24 hrs notation into 12 hrs and add AM/PM?
    For converting into 12 hrs and appending AM/PM you can use this code:
    input a:
    int hr = Integer.parseInt(a.substring(11,13));
    String appendVal = "AM";
    if(hr > 12){
       hr = hr - 12;
       appendVal = "PM";
    } else if(hr == 12){
       appendVal = "PM";
    } else if(hr == 00){
       hr = hr + 12;
    Sting finalVal = a.substring(0,11) + String.ValueOf(hr) + a.substring(13,a.length()) + appendVal;
    return finalVal;
    Regards,
    P.Venkat
    Message was edited by:
            Venkataramanan

  • SQL * Loader : Load data with format MM/DD/YYYY HH:MI:SS PM

    Please advice how to load data with format MM/DD/YYYY HH:MI:SS PM into an Oracle Table using SQL * Loader.
    - What format should I give in the control file?
    - What would be the column type to create the table to load data.
    Sample data below;
    MM/DD/YYYY HH:MI:SS PM
    12/9/2012 2:40:20 PM
    11/29/2011 11:23:12 AM
    Thanks in advance
    Avinash

    Hello Srini,
    I had tried with the creation date as DATE datatype but i had got an error as
    ORA-01830: date format picture ends before converting entire input stringI am running the SQL*LOADER from Oracle R12 EBS front-end.
    the contents of my control file is
    LOAD DATA
    INFILE "$_FileName"
    REPLACE
    INTO TABLE po_recp_int_lines_stg
    WHEN (01) = 'L'
    FIELDS TERMINATED BY "|"
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    INDICATOR                POSITION(1) CHAR,
    TRANSACTION_MODE          "TRIM(:TRANSACTION_MODE)",
    RECEIPT_NUMBER               "TRIM(:RECEIPT_NUMBER)",
    INTERFACE_SOURCE          "TRIM(:INTERFACE_SOURCE)",
    RECEIPT_DATE               "TO_CHAR(TO_DATE(:RECEIPT_DATE,'MM/DD/YYYY'),'DD-MON-YYYY')",
    QUANTITY               "TRIM(:QUANTITY)",
    PO_NUMBER               "TRIM(:PO_NUMBER)",
    PO_LINE_NUMBER               "TRIM(:PO_LINE_NUMBER)",
    CREATION_DATE               "TO_CHAR(TO_DATE(:CREATION_DATE,'MM/DD/YYYY HH:MI:SS AM'),'DD-MON-YYYY HH:MI:SS AM')",
    ERROR_MESSAGE                   "TRIM(:ERROR_MESSAGE)",
    PROCESS_FLAG                    CONSTANT 'N',
    CREATED_BY                      "fnd_global.user_id",
    LAST_UPDATE_DATE                SYSDATE,
    LAST_UPDATED_BY                 "fnd_global.user_id"
    {code}
    My data file goes like
    {code}
    H|CREATE|123|ABC|12/10/2012||||
    L|CREATE|123|ABC|12/10/2012|100|PO12345|1|12/9/2012  2:40:20 PM
    L|CORRECT|123|ABC|12/10/2012|150|PO12346|2|11/29/2011 11:23:12 AM{code}
    Below is the desc of the table
    {code}
    INDICATOR             VARCHAR2 (1 Byte)                         
    TRANSACTION_MODE        VARCHAR2 (10 Byte)                         
    RECEIPT_NUMBER             NUMBER                         
    INTERFACE_SOURCE        VARCHAR2 (20 Byte)                         
    RECEIPT_DATE             DATE                    
    QUANTITY             NUMBER                    
    PO_NUMBER             VARCHAR2 (15 Byte)                         
    PO_LINE_NUMBER             NUMBER                         
    CREATION_DATE             TIMESTAMP(0)                         
    ERROR_MESSAGE             VARCHAR2 (4000 Byte)                         
    PROCESS_FLAG             VARCHAR2 (5 Byte)                         
    CREATED_BY             NUMBER               
    LAST_UPDATE_DATE        DATE               
    LAST_UPDATED_BY             NUMBER     {code}
    Thanks,
    Avinash                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with oracle.jbo.domain.Date and format 'dd.MM.yyyy'

    JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value: 09.10.2003
    In EOImplMsgBundle :
    {"Dbeg_FMT_FORMATTER", "oracle.jbo.format.DefaultDateFormatter"},
    {"Dbeg_FMT_FORMAT", "dd.MM.yyyy"}};
    In VOImplMsgBundle :
    {"Dbeg_FMT_FORMAT", "dd.MM.yyyy"},
    {"Dbeg_FMT_FORMATTER", "oracle.jbo.format.DefaultDateFormatter"},
    Why ? Help Please

    I have the same problem !
    I have extended the formatinfo.xml with:
    <DOMAIN CLASS="oracle.jbo.domain.Date">
    <FORMATTER name="Simple Date" class="oracle.jbo.format.DefaultDateFormatter">
    <FORMAT text="dd.MM.yyyy" />
    <FORMAT text="dd-MM-yyyy" />
    <FORMAT text="yyyy-MM-dd" />
    <FORMAT text="yyyy-MM-dd G 'at' hh:mm:ss" />
    <FORMAT text="EEE, MMM d, ''yy" />
    </FORMATTER>
    </DOMAIN>
    And then I have set my attibutes to use this FORMATTER with FORMAT "dd.MM.yyyy".
    When I start my application, I became an error and the date-fields are blank ... The application can not convert my Date in 'dd.MM.yyyy' format ...
    When I set my attributes to Format Type <none>, it works, the date-fields are present ...

  • Data Extraction Format - Crystal?

    Hello,
    Is is possible to use crystal reporting tools to sort the data from inventory services. Does anyone use the ZEN WSBROWSER Utility to look at the database? Is there a better way that our helpdesk can use?
    Thanks in advance
    Alan

    Trying to connect the sybase database to crystal but having real problems. Followed instructions in the Novell guides.
    Is setting it up the SQL way better? Any info?
    Thanks
    Alan
    >>> Marcus Breiden<[email protected]> 22/03/2007 20:06:25 >>>
    On Thu, 22 Mar 2007 15:31:30 GMT, Alan Graham wrote:
    > Is is possible to use crystal reporting tools to sort the data from inventory services.
    sure... the schema of the database is documented and it is a sql language
    database
    Marcus Breiden
    If you are asked to email me information please change -- to - in my e-mail
    address.
    The content of this mail is my private and personal opinion.
    http://www.edu-magic.net

  • Importing ansi date time format into diadem

    Hi,
    I have an ANSI data log txt file with the time channel format  30/03/2006 15:51:08.846 and i am trying import into DIADEM  using the date/time format dd/mm/yyyy hh:nn:ss.fff , but when the file is imported, the time channel cells appear as NO VALUE. Can anybody help please ?
    AdeK

    Hi Adek,
    Here is a DataPlugin which loads your data file into DIAdem 10.2.  There are a number of advantages to using a DataPlugin over the ASCII Import Wizard, so long as your data files follow a similar data file structure.  To register the DataPlugin, just detach the ZIP file, unzip the URI file within, then double-click on the URI file in Windows Explorer.  After that, you will be able to load your TXT data files by dragging&dropping them directly from the NAVIGATOR tree view or Search Results into the Data Portal on the right hand side of DIAdem.  DataPlugins also support selective loading, register loading, reduced loading, and DataFinder indexing, so all of these immediately become available to you with your TXT files.  Note also that header lines 2-4 are now declared as both File and Group properties.
    Ask if you have questions using the DataPlugin,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Adek_TXT.zip ‏2 KB

  • How to change date formate mm/dd/yyyy to dd/mm/yyyy

    Hi,
    In OBPM the date picker will come by default like mm/dd/yyyy. But my requiremet is i want to change to the formate dd/mm/yyyy. pls help me if any one knows this.
    Regards
    Jaya

    In generated presentation datepicker is formating the date by java script dependend on users locale.
    To format these dates to dd/mm/yyyy just add a new language en-GB.
    1. Decompress the file "C:\Oracle\BPMStudio1032\webapps\workspace\WEB-INF\lib\fuego.resources_en_6.5.0.jar" somewhere.
    2. Edit the file: plugin.xml and add GB in country:
    <locale availableOnIDE="true" className="fuego.resources.EmptyLocaleSupport" language="en" country="GB" variant=""/>
    3. Edit the file Manifest.MF and enter your locale
    Bundle-Name: Oracle BPM Resources en-GB Plug-in
    Bundle-SymbolicName: fuego.resources.runtime.en_GB; singleton:=true
    3. Compress (or use jar) the extracted folders & files into a jar named:fuego.resources_en_GB_6.5.0.jar (make sure you keep the same folder structure as in the original jar).
    4. Copy the jar to all required directories (for a list see http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/pdf/OracleBPM-AdminGuide_10.3.pdf section 'Adding a New Language to WorkSpace').
    5. Restart Workspace.
    In Workspace chance users language (settings) to English - United Kingdom.

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Problem with date format dd/mm/yyyy. But I need to convert yyyy-mm-dd.

    Dear friends,
    I have the problem with date format. I receiving the date with the format dd/mm/yyyy. But I can upload to MySQL only in the format of yyyy-mm-dd.
    how should I handle this situation, for this I've created these code lines.But I have some problem with these line. please help me to solve this problem.
    String pattern = "yyyy-mm-dd";
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    try {
    Date date = format.parse("2006-02-12");
    System.out.println(date);
    } catch (ParseException e) {
    e.printStackTrace();
    System.out.println(format.format(new Date()));
    this out put gives me Tue Apr 03 00:00:00 IST 2007
    But I need the date format in yyyy-mm-dd.
    regards,
    maza
    thanks in advance.

    Thanks Dear BalusC,
    I tried with this,
    rs.getString("DATA_SCAD1")// where the source from .xls files
    String pattern = "yyyy-MM-dd";
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    try {
    Date date = format.parse("DATA_SCAD1");
    System.out.println(date);
    } catch (ParseException e) {
    e.printStackTrace();
    System.out.println(format.format(new Date()));
    this out put gives me Tue Apr 03 00:00:00 IST 2007
    But I want to display the date format in yyyy-mm-dd.
    regards,
    maza

  • How to convert the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:M'

    How can i convert a the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:MI:SS AM' in Oracle
    I have a query
    select UPPER(t.val_10) "TYPE", count(val_3) "Number of Transfers"
    from table1 t
    where t.is_active = 1
    and t.val_4 = 'INBOUND'
    and to_date(to_date(val_5,'MM/DD/YYYY HH:MI:SS AM'), 'DD/MM/YY') between to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY') and add_months(to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY'),1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)
    I get the error [ORA-01861: literal does not match format string which i think is because
    val_5 has the values in the following format:
    8/29/2008 6:31:10 PM
    Does anyone have an answer?
    Thanks in advance
    Edited by: user2360027 on 26-Mar-2009 03:50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    first off, you've got to_date(to_date(...)) - NEVER do this - you're forcing an implicit to_char which can cause all sorts of problems!
    What is the data type of your column val_5? If it's DATE then your query is simply:
    select UPPER(t.val_10) "TYPE",
           count(val_3) "Number of Transfers"
    from   table1 t
    where  t.is_active = 1
    and    t.val_4 = 'INBOUND'
    and    val_5 between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)If it's a varchar2 (why, oh why, oh why, ...?!), then your query should be:
    select UPPER(t.val_10) "TYPE",
           count(val_3) "Number of Transfers"
    from   table1 t
    where  t.is_active = 1
    and    t.val_4 = 'INBOUND'
    and    to_date(val_5, 'mm/dd/yyyy hh:mi:ss AM') between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)Remember that dates in DATE format are stored in an internal Oracle format - in order for you to tell Oracle that your string is a date, you need to use to_date. When you want to retrieve a date, you need to use to_char to put it into the format you want to see it in.
    Remember also that your nls_date_format defines the default format that you'll see a date, which is what is used in the implicit conversion that oracle does when you select a date:
    SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    26/03/2009 11:01:53
    1 row selected.
    SQL> alter session set nls_date_format='mm/dd/yy hh12:mi:ss AM';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    03/26/09 11:02:24 AM
    1 row selected.It doesn't make sense to convert something that's already in a DATE format into a DATE format - in order to do that, oracle has to first change the date into a string, and it does that by using the nls_date_format parameter setting - if you're working with dates-in-strings that are in a different format, then all sorts of problems arise, as you have found out!

  • Date validation in "DD-MON-YYYY" Format,

    Hi ,
    I have created a textbox with date picker as (dd-mon-yyyy) .
    Now i want to create a validation on it for the format (dd-mon-yyyy) .
    I have created a pl/sql code with type "function returning error text".
    Begin
    If :P4_END_DATE IS NOT NULL THEN
    if :P4_END_DATE != to_date(:P4_END_DATE ,'DD-MON-YYYY') then
    return 'END DATE should be in "DD-MON-YYYY" Format';
    end if;
    END IF;
    End;
    When i type in like 20-NOV-08 it gives error as 'START DATE should be in "DD-MON-YYYY" Format',
    but when i change month like 20-11-2008 , it actually gives error
    ORA-01843: not a valid month
    Error ERR-1024 Unable to run "function body returning text" validation.

    Vaibss wrote:
    Hi ,
    I have created a textbox with date picker as (dd-mon-yyyy) .
    Now i want to create a validation on it for the format (dd-mon-yyyy) .
    I have created a pl/sql code with type "function returning error text".
    Begin
    If :P4_END_DATE IS NOT NULL THEN
    if :P4_END_DATE != to_date(:P4_END_DATE ,'DD-MON-YYYY') then
    return 'END DATE should be in "DD-MON-YYYY" Format';
    end if;
    END IF;
    End;
    When i type in like 20-NOV-08 it gives error as 'START DATE should be in "DD-MON-YYYY" Format',
    but when i change month like 20-11-2008 , it actually gives error
    ORA-01843: not a valid month
    Error ERR-1024 Unable to run "function body returning text" validation.The call to 'to_date' is raising an exception when it tries to convert your date, standard PL/SQL exception handling takes over and the rest of your code is ignored.
    You could try:
    declare
    pragma exception_init(invalid_date,-01830);
    l_dummy date;
    Begin
    If :P4_END_DATE IS NOT NULL THEN
    l_dummy := to_date(:P4_END_DATE ,'DD-MON-YYYY') then
    END IF;
    exception
    when invalid_date then
    return 'END DATE should be in "DD-MON-YYYY" Format';
    End;
    but even that will not check that the user actually used your desired format - the to_date can be quite flexible e.g. accepting separators other than the '-' that you have declared. In fact, the above would only catch the user entering a 'date' that is shorter than the format string - changing the 'invalid_date' for 'others' would capture more (all!) exceptions.
    You probably want to look at using regular expressions to perform the format validation.
    Edited by: Andy Hardy on Nov 25, 2008 12:29 PM

  • How to convert Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2 ?

    Hi,
    I am getting the error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."
    when converting date in format Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2.
    Please note that the date in column is Date(varchar(50), null).
    I used the following syntax:
    SELECT  CONVERT(VARCHAR(10), Date, 102) AS Day
    FROM   dbo.[RCap_2G MM/Operator]
    WHERE  (CONVERT(VARCHAR(10), Date, 102) > { fn NOW() } - 1)

    As noted above, either use ISDATE or TRY_CONVERT with the correct conversion style number:
    -- SQL Server 2012 code
    DECLARE @Date varchar(50) = '10/23/2006 10:20';
    SELECT TRY_CONVERT(DATE, @Date, 101) AS Day
    -- 2006-10-23
    Datetime conversion blog:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Converting Date Column to format MM/DD/YYYY in RPD

    Hi all,
    I have a requirement like converting a Date column to format MM/DD/YYYY in RPD. Any help as we are not supposed to use the BI Answers Data Fomat for showing this format.
    Thankyou,
    Edited by: [email protected] on May 10, 2010 11:49 PM

    Hi Saichand,
    I need the resulting column in DATE format only. The solution which you specified converts the datatype to character. Is there anyway to convert the format but not the datatype.

  • Validating a text field that has date in the format mm/dd/yyyy

    How can I validate a text field such that it should be in the format mm/dd/yyyy and it should not be greater that a particular date.
    for example the date I enter should not be greater than 01/01/2007

    What you can do is use the SimpleDateFormat class to try and parse the text date into a Date object like this:
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    Date mydate = sdf.parse(textdate);if that fails than the date has the wrong format (you'll get a ParseException if I'm not mistaken).
    The next step is to create a Date for 1/1/2007 and then do a date compare between your two dates. You can create a date yourself using the Calendar class.

  • URGENT !!!!   Problem with Date format MM/DD/YYYY in oracle database to BW

    Hi
    I am wondering if somebody can help me urgently.
    I have oracle database where date is of the format MM/DD/YYYY and I am loading data into BW. DATE data type
    Date in oracle database: 3/30/2007
    First when I used InfoObject ZDATE (with 0DATE) reference (DATS data type) data load failed saying that
    'Value '30-MAR-0 ' of characteristic 0DATE is not a number with 000008 spaces'
    Then I created ZDATE InfoObject as CHAR Type (Length 10) with PDATE Conversion Routine.
    when I created datasource using DB Connect and checked the contents using 'Display Table Contents' after creating data source the data field distorted as
    AR/-0/30-M
    After data load. when I checked PSA
    The Date records look same as AR/-0/30-M
    In cube the field appeared as  30-MAR-0  (last digit of year disappearing)
    In BEx report also it looks like 'AR/-0/30-M'
    Can somebody help me as quickly as possible.
    What should I do if i want to still use DATS data type for ZDATE?
    should I change date format in database if so to what?
    If I should use CHAR type with PDATE or any other routine can somebody give me the routine to have the date in the report exactly as it appears in database?
    I also tried changing date format in user profile...settings. But still its the same.
    Thanks in advance.

    Hello Snrella,
    You can solve this by converting the date format from oracle to the SAP internal date format  using an ABAP routine in the transfer rules.
    Assuming the oracle data field name is ZODATE then here's the ABAP you can use in the transfer rules. Create an ABAP routine transfer rule from ZODATE to your ZDATE infoobject, and then put this ABAP code there. (this code assumes that the format of the date from oracle is MM/DD/YYYY).
    concatenate tran_structure-/BIC/ZODATE+6(4) tran_structure-/BIC/ZODATE(2) tran_structure-/BIC/ZODATE+3(2) into result.
    Hope this helps.

Maybe you are looking for