Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7726049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:06:48+00:00 2026-06-01T05:06:48+00:00

In my CakePHP-1.2 application, I am using the date format 01-Jan-2012 Which date validation

  • 0

In my CakePHP-1.2 application, I am using the date format 01-Jan-2012

Which date validation rule should I use to test it?

I tried array(‘date’, ‘dMy’) . But it is not working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:06:50+00:00Added an answer on June 1, 2026 at 5:06 am

    By reading the book, you can see that you cannot use separators in the date validation field for the algorithm you have selected. You will need to create a custom validation rule. You can do this using a Custom Regular Expression rule:

    '/^((31(?!\\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\\b|t)t?|Nov)(ember)?)))|((30|29)(?!\\ Feb(ruary)?))|(29(?=\\ Feb(ruary)?\\ (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])\\-(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)\\-((1[6-9]|[2-9]\\d)\\d{2})$/';

    Note: This rule is a modified version of the canned ones that cake is shipped with.

    So, you would want to do:

    var $validate = array(
        'born' => array(
            'rule' => '/^((31(?!\\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\\b|t)t?|Nov)(ember)?)))|((30|29)(?!\\ Feb(ruary)?))|(29(?=\\ Feb(ruary)?\\ (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])\\-(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)\\-((1[6-9]|[2-9]\\d)\\d{2})$/i', 
            'message' => 'Enter a valid date in Day-Mon-Year format.'
        )
    );
    

    Note: the ‘i’ at the end of the regular expression, this simply denotes that it is a Case Insensitive match. This will match 24-Dec-2006, 24-DEC-2006, and 24-dec-2006 alike. Remove it if you want to accept the case sensitive match.

    Now, you can simply run that rule against the field in question, and you should be good to go.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the webtechnick Facebook plugin to use Facebook authentication in my cakephp application.
I wrote an application using CakePHP. I set everything to use UTF-8 encoding (the
I'm using CakePHP to build an application using the MVC Pattern, but my question
I am using a very intrinsic database with a CakePHP application and so far
After I uploaded my application created using cakephp, I found out that I had
I am developing an application in cakephp. In this application I am using saveAll()
I am using JQuery and cakephp for my application. I have created a select
I have made a full application in JQM using cakePHP as the server side
I am using cakephp framework to build my application. I want that, whenever a
I want to run a web application on php and mysql, using the CakePHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.