Date validation in " DD-MON-YYYY"

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.
Edited by: Vaibss on Nov 25, 2008 2:09 AM
Edited by: Vaibss on Nov 25, 2008 2:10 AM

Hello,
Duplicate post -
Date validation in "DD-MON-YYYY" Format,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

Similar Messages

  • 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 can I change defaut date format to dd-mon-yyyy in bi analytics

    hi..
    How can I change the default date format to DD-MON-YYYY in BI Analytics...
    I am passing a date in a report from a prompt....but it is always taking "dd-mon-yyyy hh:mm:ss" format...I want to input the prompt in oracle's default date format i.e dd-mon-yyyy..
    please help...I dont want to use cast function because it will convert the date into a character value....I want a date...

    Hi USer
    Try this link
    How to change date format in OBIEE
    Re: repository variable at date prompt
    Thanks
    Diney

  • Date validation in dd/mm/yyyy format

    hi,
    I am using SimpleDateFormat to validate date but it not working properly It is not validating against date range and leap year.
    String stringDate = "40/02/1999";
    try
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    ParsePosition pos = new ParsePosition(0);
    Date date = formatter.parse(stringDate, pos);
    System.out.println("correct");
    catch (Exception e)
    e.printStackTrace();
    }

    Have a look at the calendar class, in particular :
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Cale
    ndar.html#setLenient(boolean)Calendar isn't needed here. He sould stick with SDF.Infernal jverd !! ;-P
    For some reason i skipped over your reply completely, and I knew there was a setLenient in Calendar, so I was going to point him there. OP listen to jverd.

  • Problems with date validation pattern DD.MM.YYYY in Form Builder

    (I am using LiveCycle Designer 8.0.)
    My form uses an input date field which consistst of DD.MM.YYYY.
    Display pattern, edit pattern, validation pattern and date pattern has been set to DD.MM.YYYY.
    "Validation Pattern Message"-box has been set to checked.
    "Validation Script Message"-box is not checked.
    1. When I type:      313101
    the system converts the digits to the date 01.01.3131
    2. When I type:      3131
    the system converts the digits to the date 01.01.3131
    3. When I type:       31   
    I get an error message "Date is not valid."
    I need a form to throw an error message if the user doesn`t type the correct input
    DD.MM.YYYY.  (01.03.2009)
    Thanks in advance.
    Tor

    Does anyone have any input on this matter?
    Thanks in advance.
    Regards,
    Tor

  • Date validation

    Hi ,
    I have a created an 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.

    Hello,
    You have duplicated this post, see my answer here -
    Re: Date validation in "DD-MON-YYYY" Format,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Query records using a date DD-MON-YYYY in Forms 6i and 10g

    In Forms 6i, I can query records by entering >20-dec-2006 in a date field which has length of 12 with a date format mask DD-MON-YYYY in date item property. Once this form is converted to 10g, I can only enter >2-dec-2006 for querying. If trying to enter the >20-dec-2006, then, it becomes >20-dec-200 and have no record found. Although I have the date length increased to 20, the result stays the same: can't enter 2 digits for day.
    Thanks for your help in advance.

    Appreciate your help. The date field has a format mask of DD-MON-YYYY. By entering >2-dec-2005 it will automatically be displayed as >2-DEC-2005 in Forms 6i or 10g. Also, the query property has case insensitive checked as Yes. The problem is with 10g, I can not enter anything at the 12th position. I can enter the date up to the 11th position >20-dec-200. In Forms 6i, this is not a problem. Thanks.

  • Date format from mm/dd/yyyy to dd-mmm-yyyy

    How to convert the date from 01/01/2006 to 01-Jan-2006??

    Hi sravanthi,
    1. we have to apply some logic for that,
       and use the standard FM
       'MONTH_NAMES_GET'
    2. i have an independent FORM/PERFORM
       in which we give input as some date,
       and it returns date in format
       dd-mon-yyyy.
    3. just copy paste in new program and run.
    report abc.
    DATA : mname(25) TYPE c.
    PARAMETER : d TYPE sy-datum default sy-datum.
    PERFORM getmonth USING d mname.
    WRITE :/ mname.
    FORM getmonth USING d mname.
      DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
      DATA : m(2) TYPE c.
      m = d+4(2).
      CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
      TABLES
      month_names = month_names
      EXCEPTIONS
      month_names_not_found = 1
      OTHERS = 2
      READ TABLE month_names INDEX m.
      IF sy-subrc = 0.
        mname = month_names-ktx.
      ENDIF.
    concatenate d+6(2) '-' mname '-' d(4) into mname.
    ENDFORM. "getmonth
    regards,
    amit m.

  • MON/YYYY period format in OFA r12

    Hi,
       We recently upgraded from 11i10 to r12.1.3. We found recently the period format in Oracle Fixed Assets has changed to 'MON/YYYY' instead of 'MON-YYYY' format since current FY. If I query the fa_calendar_periods (table) i found the period_name column has data in the same MON/YYYY format.
    What do I need to change to get the period name format back to MON-YYYY format. Also, I noticed starting next FY, it lists as 'MON/YYYY-YYYY', which is even more confusing for the users,
    I doubt this is oracle standard as it is not consistent across modules such as general ledger, project costing etc. I searched on metalink and found none to help.
    If anyone has any solution, please advice.
    Thanks in advance,
    Kwin.

    little more explanation would help here to address the issue.
    drop me the sample xml , template you have to my id, id is in my profile.

  • Convert varchar2 field into date formatted: DD-MON-YYYY

    Thanks in advance for anyone's help on this matter as I know it takes your time and expertise. I am pretty new to SQL but learning my way through it just have an issue with a text to date field conversion. It is an Oracle 10g database and I am writing in SQL. There is a field called Demand which is formatted in varchar2 format of ddmmyy. There is also a field that is formatted as a date called Payment which is formatted as DD-MON-YYYY.
    Essentially I need to do a simple Payment >= Demand, however as you can see that is some issue with that being a varchar2 field. Does anyone know if it is possible to do that type of expression against those two fields. Was thinking about possibly converting the varchar2 to a date but not sure how to get to that DD-MON-YYYY format.
    Also there are situations where this Demand field will often times be null as it would have never recieved any outbound correspondence in the past and would not have a date at all.
    Thanks
    Edited by: user10860766 on Aug 18, 2009 8:14 AM
    Edited by: user10860766 on Aug 18, 2009 8:19 AM

    Hi,
    It's hard to detect bad dates in pure SQL, especially if you need to be precise about when February 29 is valid.
    It's easy with a user-define function, like the one in [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3669932&#3669932].
    Edited by: Frank Kulash on Aug 18, 2009 3:50 PM
    To create a stand-alone function:
    CREATE OR REPLACE FUNCTION     to_dt
    (     in_txt          IN     VARCHAR2                    -- to be converted
    ,     in_fmt_txt     IN     VARCHAR2     DEFAULT     'DD-MON-YYYY'     -- optional format
    ,     in_err_dt     IN     DATE          DEFAULT     NULL
    RETURN DATE
    DETERMINISTIC
    AS
    BEGIN
         -- Try to convert in_txt to a DATE.  If it works, fine.
         RETURN     TO_DATE (in_txt, in_fmt_txt);
    EXCEPTION     -- If TO_DATE caused an error, then this is not a valid DATE: return in_err_dt
         WHEN OTHERS
         THEN
              RETURN in_err_dt;
    END     to_dt
    /To use it:
    SELECT  primary_key  -- and/or other columns to identify the row
    ,       demand
    FROM    table_x
    WHERE   demand          IS NOT NULL
    AND     to_dt ( demand
               , 'DDMMYY'
               )          IS NULL;

  • Need regular expression for oracle date format 'DD-MON-YYYY'

    Hi,
    Can anybody tell me the regular expression to validate date in 'DD-MON-YYYY'.
    My concept is i have a table with just two columns item_name and item_date
    Both fields are varchar2 and i want to fetch those records from this table which have valid date format('DD-MON-YYYY').

    If it must be a regexp, this is a starter for you, note it carries the caveats mentioned by both posters above and in the linked thread
    mkr02@ORA11GMK> with data as (select '10-jan-2012' dt from dual
      2  union all select '10-111-2012' from dual
      3  union all select 'mm-jan-2012' from dual
      4  union all select '10-jan-12' from dual)
      5  select
      6  dt,
      7  case when regexp_like(dt,'[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}','i') then 1 else 0 end chk
      8  from data
      9  /
    DT                 CHK
    10-jan-2012          1
    10-111-2012          0
    mm-jan-2012          0
    10-jan-12            0It will not validate content, only string format.
    And to emphasis the points made in the linked thread - dates in text columns is poor design. Always.

  • Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher

    Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher where date should be displayed as date only not string.

    I've tried to use hierarchy node variables, but it seems like you can't specify a attribute of the hierarchy such as level.  So with the WBS hierarchy, if you create a hierarchy node variable, you specify the WBS value to select (If I understand this correctly).  I wish I could instead specify "give me all the WBS nodes that happen to have the value of the level attribute greater or equal to 3.  If I understand Juergens post, he is saying make security access so that only certain WBS levels can be returned in the query.  I suppose we can try that, but that would then preclude getting the level 1 and 2 in the future if the authorization is global.

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

  • How to display date in dd-mon-yyyy hh:mm am/pm format

    Hi,
    I want to display date in dd-mon-yyyy hh:mm format in OA Page. Can any body pls give me sample code that i can write in the controller.
    Regards,
    Ram

    The date format in OAF Pages is controlled by profile ICX: Date format mask.This profile can be set at site as well as user level for the individual users to set the Date format.
    But I would advice not to go for setting different profile values at user level, because i remember some old threads, where seeded Oracle pages fail, as code their is not generalised to handle date formats.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Date should be in this format DD-MON-YYYY  HH:MI:SS

    Hi All,
    I am having a column date data type ,in that i am using SYSDATE and formating as DD-MON-YYYY HH:MI:SS but result iam not getting in this format,any one please help me regarding this..
    Thanks in Advance..
    Edited by: 30021986 on Oct 14, 2012 1:38 PM
    Edited by: 30021986 on Oct 14, 2012 3:38 PM

    there is a misunderstanding.
    Your database column is in a DATE type. This is a type, and thanks to this type, you can DISPLAY the date in various ways in a query editor (toad, sql developer...).
    I mean, there is no various physical Date type columns, but only one called "date".
    If you want to display this date in the way "DD-MON-YYYY HH:MI:SS", then convert it into "CHAR" (or VARCHAR) type with the function TO_CHAR (in oracle).
    Example : to_char(sysdate, 'DD-MMMM-YYYY HH24:MI:SS").
    But the result will be an alphanumeric type. You won't be able to do further operation on date, like adding a day for instance.
    That's why you should keep the date format in the column of your database table, but convert it in your queries.
    If you really need to have this specified format, then use the char or varchar type in your database table.

Maybe you are looking for

  • Help needed in select query to take date

    Hello, I am using Oracle 11g. I am using this query select to_date(to_char(to_date((SOURCE_MONTH||'-'||SOURCE_YEAR),'MM-YYYY'),'Mon-YYYY'),'MON-YYYY') date_ from tab1 a,tab2 b where b.col2=a.col1; I have a table with 2 separate varchar columns month

  • Anyone captured an RLDP trace

    I have not been able to get WiSM controllers on 4.x code to detect a wire-side rogue with open auth (Cisco AP and Apple Airport Express). It did find the open Airport AP once when running 3.x code, but has not since the upgrade. Has anyone succcessfu

  • Baseline timephased data disappeared in MS Project 2013 with Project Server 2013!!!

    Hi, I am facing a very strange problem within a custom "task usage" view that I'  ve created. In the right pane I have three timephased fields (work, baseline  work and actual work). When I first add resources to tasks and save baseline  everything w

  • How to throw error from process without raising exception

    Hi , I like to throw error messages in Process error section whenever my If condition fails from PL/SQL anonymous block.The process is fired after submit-computation and validation.Also i like to avoid placing raise_application_error from the Process

  • InfoSource and Source System Not getting collected while activation BC

    Hello there!     I'm trying to activate the business content. If i group all the objects below and install a cube (or update rules), it gets everything but infosources (Transfer Rules, etc.) and the source system assignment. Neverthless, if i assign