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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:32:00+00:00 2026-06-05T22:32:00+00:00

I found a php function checkdate() , but strangely enough it only seems to

  • 0

I found a php function checkdate() , but strangely enough it only seems to accept data in format of int $month , int $day , int $year. However I am passing the date as a string (example "2012-06-13") so I came up with this workaround, because I would only allow date entered in such format. Unfortunately I am feeling this is both insecure and not a nice approach to the problem:

function CheckAdditional($value)
{
    $data = explode("-", $value);

    return checkdate($data[1], $data[2], $data[0]);
}

Question: is there a better way to check whether the date is valid?

  • 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-05T22:32:03+00:00Added an answer on June 5, 2026 at 10:32 pm
    <?php
    
    function CheckAdditional($value)
    {
        return date('Y-m-d', strtotime($value)) == $value;
    }
    
    ?>
    

    After several tests from both me and the people who tried to help me with my answer, I came up with this which suits me perfectly fine and is both easy and really reliable solution in my opinion as none was able to prove it wrong so far.

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

Sidebar

Related Questions

The only similar question I have found is: Insert php boolean into mysql bit
I have found some odd behaviour while I was using the PHP function in_array()
So I found a function from http://php.net/manual/en/function.exec.php function execInBackground($cmd) { if (substr(php_uname(), 0, 7)
I found a nifty little php function to check whether a url is an
This PHP function working just fine: if (preg_match (/<(\S+@\S+\w)>.*\n?.*55[0-9]/i,$body,$match)) { echo found!; } in
A PHP function I am writing pulls a small bit of HTML data from
I found the following function can draw a vertical gradient in PHP. However, many
I've found this script to merge two images (keeping transparency) in php: function imagecopymerge_alpha($dst_im,
I tried this to format the XML output in a PHP function with the
Is it possible to call a PHP function found in a file on another

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.