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 8559569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:04:59+00:00 2026-06-11T16:04:59+00:00

I have a form using which users can edit their own birthdate, i save

  • 0

I have a form using which users can edit their own birthdate, i save the birthdates in the DB in this format 15/24/1989 which is dd/mm/yyyy

how can i check that the form birthday post value is formatted as shown?

also what if i pass 12/00/hello ?

i think i need numerics only and in a range of date 01 > dd < 31 , 01 > mm < 12 , 1920 > yyyy < current_year –

  • 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-11T16:05:00+00:00Added an answer on June 11, 2026 at 4:05 pm
    $date = date("d/m/Y", strtotime($this->input->post('date')));
    

    To validate date in this format you should use this function.

    function checkDateFormat($date) {
        if (preg_match('/^\d{2}\/\d{2}\/\d{4}$/', $date)) {
            if(checkdate(substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4)))
                return true;
            else
                return false;
        } else {
            return false;
        }
    }
    

    It will check the date format, as well as check the actual date itself with the PHP checkdate() function.

    checkDateFormat("10/10/2010"); // true
    checkDateFormat("29/02/2008"); // true
    checkDateFormat("29/02/2007"); // false
    checkDateFormat("10/10/20101"); // false
    checkDateFormat("ilikecookie"); // false
    

    etc.

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

Sidebar

Related Questions

I have a form where users can store and edit their skills in different
I have a webpage with a form, which looks kinda like this: @using (Html.BeginForm(MyAction,
I have popup which is opened using: <%= link_to user.username, /users/+user.id.to_s+/edit, :method => :post,
I have a form which binds a model and a file upload using the
I'm developing a site using the CakePHP framework. I have a form which shows
I am creating one form in html using table. Which have one Drop down
I have several DropDown controls on a Web Form which are filled using AJAX
I am using ASP.NET MVC 1.0. I have an ActionResult which receives a form
Im using c# .net , windows form application. I have a XML file which
In my ASP MVC 3 application, I have this form @using (Html.BeginForm()) { <input

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.