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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:20:31+00:00 2026-05-27T17:20:31+00:00

I am converting an ASP application to PHP and am having difficulty transcribing date

  • 0

I am converting an ASP application to PHP and am having difficulty transcribing date validation functionality.

In ASP, I have the function isDate(), which allows me to validate a date regardless of its format. So if someone enters any of the following, isDate() returns true:

1/1/2012
January 1, 2012
Jan 12, 2010 1:00 pm
1/1/2012 1:32 pm

The benefit is that I can let the user enter the data and time in whatever format they choose. After that, with minimal effort, I can update a database without doing any post processing (assuming true is returned). E.g.:

UPDATE my_table SET date_field = @date_var WHERE my_id = @id_var
[note: SQL Server 2008]

With PHP, I’m finding that validating a date/time is more complex. I’ve reviewed the assorted questions posted here as well as the documentation and there doesn’t seem to be a straightforward way to validate a date or time or date/time combination easily.

I’m wondering if there are classes available to do the grunt work. Something that will work like isDate() and send me back a true/false based on a user entered date/time/date & time.

Thanks.

  • 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-05-27T17:20:32+00:00Added an answer on May 27, 2026 at 5:20 pm

    You can check the return value of strtotime() to see if a date can be parsed:

    if(strtotime($date) !== false) {
       // valid date/time
    }
    

    This is also how to normalize all the dates, by storing them as the return value of strtotime().

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

Sidebar

Related Questions

I have an existing ASP.NET web application that I'm converting to MVC 1.0. The
I am converting a classic ASP application to PHP. In the Classic ASP app,
I am currently converting a ASP.NET C# application to PHP. The service uses DateTime
Have just started converting an existing job tracking system into an ASP.NET MVC application.
I have developed the asp.net mvc 2 + C# application. it has create functionality
I'm converting one of our ASP.NET MVC application from 1.0 to 2.0. This is
Has anybody gone through the process of converting a real-world business application from ASP.NET
I am converting an application I created using webforms to the asp.net mvc framework
I'm converting functionality from an asp.net Gridview to a Listview. In the gridview when
I am converting a script from PHP to ASP.net C#. In PHP, i could

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.