Convert DD-MON-YYYY format to MM/DD/YYYY

I have an input date variable L_DATE as 11-Aug-2013(DD-MON-YYYY).
In my procedure, I am converting the input date to MM/DD/YYYY format .
The logic I have used for the same in my Stored Proc- COMPARE2 is:
R_DATE := to_char(to_date(L_DATE,'DD-MON-YYYY'),'MM/DD/YYYY');
But this is the error that I get when the SP is run:
ORA-01843: not a valid month
ORA-06512: at "COMPARE2", line 51
ORA-06512: at line 2
Can anyone suggest how to resolve this??

Input data doesnt match NLS_DATE_LANGUAGE setting
Consider
select * from v$nls_parameters
where
parameter ='NLS_DATE_LANGUAGE'
PARAMETER VALUE
NLS_DATE_LANGUAGE AMERICAN
select
to_char(to_date('11-MAY-2013','DD-MON-YYYY'),'MM/DD/YYYY') d
from dual
D
05/11/2013
select
to_char(to_date('11-MAY-2013','DD-MON-YYYY','NLS_DATE_LANGUAGE=GERMAN'),'MM/DD/YYYY') d
from dual
ORA-01843: not a valid month
or
The month is not given literally
select
to_char(to_date('11-05-2013','DD-MON-YYYY'),'MM/DD/YYYY') d
from dual
ORA-01843: not a valid month

Similar Messages

  • How to convert sysdate to the format dd-mon-yyyy

    how to convert sysdate to the format dd-mon-yyyy

    <how to convert sysdate to the format dd-mon-yyyy>
    This question is better answered by thinking about about how Oracle dates work. SYSDATE is a pseudocolumn (function without any arguments) that returns a date value: it already is a date. Oracle date values are stored not as we see them, say 'DD-MON-YY', but as a series of bytes with the different date components from the millennium down to the second. We NEVER see dates as they are stored but use the formats for automatic conversion.
    To display a date the way you want use TO_CHAR() with an edit mask or as others suggested change your NLS_DATE_FORMAT (thought I advise against this as most systems use DD-MON-YY and porting queries from other systems or even OTN can easily break). To change a converted string back to a date use TO_DATE() with an edit mask.

  • How to convert date  into dd mon yyyy format

    hi all,
    i have a problem in date format i am using date like below .
    <%java.util.Date date = new java.util.Date();%>
    i am inserting date into a table and its storing like this
    insert into tablename (d_date) values (date)
    and its inserting date like below
    Sun Oct 19 09:05:45 GMT+03:00 2003
    i want to fetch date in dd mon yyyy format.
    with this format i want to make a select query.i struck with the format conversion.
    how to do this.
    any comments please.
    any help

    hi all,
    i understand now where i am wrong.
    the below code is not working why because in my server where i am executing code the regional setting month value is in arabic.
    i executed the same code in a different server where date and time jones are english its working fine.
    All the problem is in regional setting and not the jsp code.
    <%
    String whtEverDateFormatYouWAnt = "dd MMM yy";
    String str = new SimpleDateFormat(whtEverDateFormatYouWAnt).format(new SimpleDateFormat("EEE MMM dd HH:mm:ss vvv yyyy").parse("Sun Oct 19 09:05:45 GMT+03:00 2003"));
    out.print(str);
    %>
    Thanks a lot for the excellent solution.
    Thanks again.

  • 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

  • Converting Year in YYYY format for return in select list

    Using Apex 4.1.1 on Linux (Apex Listener on glassfish)
    I have a table with week ending dates and use this table for as my LOV.
    The select list comes up like 12-SEP-12 when I check the value attribute in Firebug. Problem is that this comes up as year 0012 instead of 2012 when I try to use it in my PL SQL code to save it to a table.
    Is there a way I can get the return value for the year in YYYY format for return value in select list? Have tried to_date(dt, 'DD-MON-YYYY') with no luck.
    Cheers.

    All APEX session state values are held as VARCHAR2s. Explicit conversion to and from DATE values using specified formats is recommended. Convert to VARCHAR2 in the LOV query:
    select to_char(week_ending, 'DD-MON-YYYY') l, to_char(week_ending, 'YYYY-MM-DD') v from ...and to DATE in the PL/SQL process code:
    ...to_date(:p1_week_ending, 'YYYY-MM-DD')...I'm trying to standardise on using ISO 8601 representations for non-displayed date values. These are unambiguous, sort properly using character semantics, and are compatible with other systems and technologies.

  • How to convert date from "yyyymmdd" to "MM/DD/YYYY" format

    1. I have one BLDAT field in my internal table.
       its getting updated from input file.
    2. The value in the input file is like yyyymmdd.
       So the internal table field is filled like this
       "YYYYMMDD".
    3. After this,I have to compare this internal table  
       field with BSAD table.
    4. The BLDAT field in BSAD table is in the format of 
       "MM/DD/YYYY".
    5. the BLDAT field is having diff format in internal  table and BSAD table.So I am unable to check this value.
    How to convert it as like the BSAD table format."MM/DD/YYYY" format.
    Thanks in advance!!

    Using the WRITE statement
      data: gd_date(10).  "field to store output date
    * Converts date from 20020901 to 09.01.2002
      write sy-datum to gd_date mm/dd/yyyy.
    OR u can
    CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
    into gd_date seperated by '/' .
    Hope this helps.
    Kindly reward points and close the thread for the
    answer which helped u OR get back with queries.

  • How to convert JAVA.SQL.DATE date in YYYY/MM/DD format into DD/MM/YYYY

    i am using informix database which accepts date value in the form of DATE format......
    the other part of my application takes date from the field in DD/MM/YYYY format...so i have to convert my java.sql.date in YYYY/MM/DD fromat into DD/MM/YYYY fromat of same type before inserting into db......
    but using parse method in SimpleDateFormat class can get the result only in java.util.date format...
    and also using format method can result only in string conversion........

    816399 wrote:
    i am using informix database which accepts date value in the form of DATE format......Huh?
    Maybe you mean Informix (fronted by JDBC) expects date values as java.sql.Date objects?
    the other part of my application takes date from the field in DD/MM/YYYY format...
    so i have to convert my java.sql.date in YYYY/MM/DD format into DD/MM/YYYY format of same type before inserting into db......I am not sure why you are talking about formats here.
    There is no formatting inherent in a java.util.Date object
    nor in a java.sql.Date object.
    but using parse method in SimpleDateFormat class can get the result only in java.util.date format...
    and also using format method can result only in string conversion........You can easily create a java.sql.Date object from a java.util.Date object.
    String s = "31/12/2010";
    java.util.Date ud = new java.text.SimpleDateFormat("dd/MM/yyyy").parse(s);
    java.sql.Date sd = new java.sql.Date(ud.getTime());
    ud = sd; // java.sql.Date extends java.util.Date so no conversion is needed

  • To convert dec date 732,677 in to dd.mm.yyyy format

    Hi,
    i have to convert dec date 732,677 in to dd.mm.yyyy format .
    plz help me out
    its urgent
    regards,
    Nishu Gupta

    use this Fm
    CONVERSION_EXIT_INVDT_INPUT
    <b>CONVERSION_EXIT_INVDT_output.</b>
    i hope u r referring to Tcurr-gdatu.
    refer this code for the working ..
    data : date like sy-datum,
           date1(10) type c,
           val like sy-datum,
           datum(8) type n .
    date = sy-datum.
    write:/ date.
    concatenate date4(2) date6(2) date+0(4) into val.
    CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'
      EXPORTING
      input          = val
    IMPORTING
       OUTPUT        = datum.
    write:/'tcurrformat' datum.
    *clear val.
    CALL FUNCTION 'CONVERSION_EXIT_INVDT_OUTPUT'
      EXPORTING
        input         = datum   "----
    >pass this
    IMPORTING
        OUTPUT        = date1.
    write:/'normal format',  date1.
    Please close your previous threads.
    regards,
    vijay

  • Function module to convert date form yyyy/mm/dd to dd/mm/yyyy format

    Can any one tell me Function module to convert date form yyyy/mm/dd to dd/mm/yyyy format?

    have a look at the WIKI FAQs...they are very useful
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abapDevelopmentand+Programming&
    For this it says:
    <i>How to convert a date to internal or external format?
    Use the functions modules CONVERT_DATE_TO_EXTERNAL or CONVERT_DATE_TO_INTERNAL
    to convert the date. When converting to external format, the date format from the user's user profile will be used. When converting to internal format, the result will be in YYYYMMDD format.</i>

  • Convert yyyymmdd date format to mm/dd/yyyy

    hi,
    I convert the date fomat in my program from yyyymmdd to dd/mm/yyyy format using this code:
    WRITE it_pos-bldat TO i_outpos-bldat MM/DD/YYYY.
    I declared the bldat field by: bldat(10) TYPE c so that the field will contain the '/' character.
    The output of my program is in alv format and the problem is when I sort the bldat field, it will be sorted as a character field and not by date.
    Ex. 01/06/2005
        02/23/2004
        03/12/2006
        04/09/2004
    It should be sorted like this:
    02/23/2004
    04/09/2004
    01/06/2005
    03/12/2006
    Please let me know how I can convert into mm/dd/yyyy format and can still be sorted in the alv by date.
    Thanks!
    Eric

    <b>HRGPBS_HESA_DATE_FORMAT</b>
    Format a date valid for HESA: DD/MM/YYYY
    data:date_form type CHAR10.
    call function 'HRGPBS_HESA_DATE_FORMAT'
    exporting
    P_DATE = sy-datum
    importing
    DATESTRING = date_form
    exceptions
    others = 1.
    write : date_form.
    also check thread..
    Re: Regarding Date conversion

  • Converting string to date in mm/dd/yyyy format

    Hi,
    I used simpledateformat to convert date to "MM/dd/yyyy" format.
    Now when i want to insert into db, i want the value as date object instead of string [returned by format method of SimpleDateFormat]
    what should i do?
    Date dt = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    System.out.println("Formatted date is coming as "+sdf.format(dt));
    Date dt1 = sdf.parse(sdf.format(dt);
    System.out.println("parsed date is coming as " +dt1);
    output :
    1 SOP returns 11/07/2007 [current date]
    2 SOP returns Wed Nov 07 00:00:00 GMT+05:30 2007

    If you are using PreparedStatements setDate method, you need a java.sql.Date object, not a Java.util.Date object. You can create an sql.Date object from a util.Date object as follows:
    java.sql.Date sqlDate = new java.sql.Date(dt.getTime());And, if you are not using PreparedStatement and its setDate method, then change now.
    Doing
    Date dt1 = sdf.parse(sdf.format(dt));is meaningless. You format the date to string, then parse the string back to a date? Why? Why not just use the original Date object? And you won't get a sql.Date object that way, either, as the DateFormat classes return a util.Date object.
    Edit: And for more info:
    A Date does not have a format. It is simply a number. The "format" only comes into play when printing the String representation of the Date, and that is not handled by the Date object itself (except when calling toString either explicitly or implicitly).

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

  • How to convert date format to MM/DD/YYYY

    Hi,
       How to convert date format to MM/DD/YYYY.
    Thanks,
    Senthil

    hi,
    tri with this function module
    data :l_date(10) type c
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
    EXPORTING
       DATE_INTERNAL                  = SY-DATUM
    IMPORTING
       DATE_EXTERNAL                  = l_date.
    this function module converts date from 20050601 to external format  which is specified in user profile
    cheers,
    sasi

  • Converting Oracle 7-Byte Internal Date FOrmat to MM/DD/YYYY format.

    I can get the date stored in the database in 7-Byte Internal representation.
    I want to convert this number to mm/dd/yyyy format,using PRO*C-SQLDA(Method 4),overriding any NLS DATE Format.
    null

    Only Oracle Spatial questions
    here please.
    null

  • How to convert system Date into DD-MMM-YYYY Format

    hi friends,
    please help me How to convert system Date into DD-MMM-YYYY Format.
    Regards
    Yogesh

    HI..
    data: w_dt(11) type c,
             w_month(2),
             w_mon(3).
    w_month = p_date+4(2). **p_date = given date**
    case w_month.
    when '01'.
    w_mon = 'Jan'.
    when '02'.
    w_mon = 'Feb'.
    when '03'.
    w_mon = 'Mar'.
    when '04'.
    w_mon = 'Apr'.
    when '05'.
    w_mon = 'May'.
    when '06'.
    w_mon = 'Jun'.
    when '07'.
    w_mon = 'Jul'.
    when '08'.
    w_mon = 'Aug'.
    when '09'.
    w_mon = 'Sep'.
    when '10'.
    w_mon = 'Oct'.
    when '11'.
    w_mon = 'Nov'.
    when '12'.
    w_mon = 'Dec'.
    endcase.
    Now...
      concatenate p_date6(2)  '-'  w_mon  '-'   p_date0(4)  into w_dt.
    write w_dt.

Maybe you are looking for

  • Web page appears different when located on local server

    I was editing a web page that is already up and running. Downloaded a copy to my local PC and everything was fine. Copied all the code to my local Microsoft Windows 2003 server and now the pages appear wrong. If the file is uploaded back to a website

  • Copying .avi files from Imac to external WD Hard Drive

    I'm new to the Mac and having a few file issues. I have copied from my old PC a number of large (12GB) .avi files to the internal (500GB) drive on my Imac. I have recently bought a 1TB WD external drive and wish to copy the avi video files on the Ima

  • Dynamic PL/SQL IR Highlight

    Hello Forum User, I have an IR and a filtering select-list item to choose a specific month. Depending on the selection of the select-list item the report values change. The column values have a timestamp format like YYYY-MM-DD HH24:MI:SS. I manually

  • How do I find out info about my G4, where  bought it, cost etc

    I need information about my G4. I bought it new some years ago but have no longer got the records of my purchase. Where can I find out those details please? The store was in Penrith, but not an Apple store as such. Even the name of the business would

  • InDesign CS4 crashes on launch

    I recently migrated my files to a new MacBook Pro. I have not been able to launch InDesign since doing so. The other CS products, while sometimes glitchy, seem to be working. The launch generates a splash page, then crashes and generates a crash repo