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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:49:41+00:00 2026-05-27T13:49:41+00:00

I need to pass a DATETIME value via a GET request and verify that

  • 0

I need to pass a DATETIME value via a GET request and verify that the date received is in the proper format and is valid. I figured that on the sending end I would convert the DATETIME value using UNIX_TIMESTAMP to make it easy to validate on the receiving end, then convert it back to DATETIME via FROM_UNIXTIME.

Otherwise it appears that on the receiving end I would need to use a regex to validate the DATETIME format and then check the date is valid with checkdate(). This seems like it must be a common issue so I am wondering if there is a way to do it that does not involve this conversion.

  • 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-27T13:49:41+00:00Added an answer on May 27, 2026 at 1:49 pm

    The DateTime class constructor accepts valid datetime strings. If it’s passed an invalid datetime it throws an exception. Once you have the DateTime object, you can format it in any way you want using DateTime::format

    $date = 'bad date string'
    
    try {
      $obj = new DateTime($date);
      echo 'valid date: '. $obj->format('Y-m-d');
    } catch (Exception $e) {
      echo 'invalid date';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pass DateTime value in C++. (Creating a plugin for AmiBroker )
So I have a flashobject which I need to pass a formatted DateTime string
I need to pass multiple arguments to a function that I would like to
I have list of DateTime values, and for each value I need to fetch
I've got a collection of around 20,000 objects that need to get persisted to
i have a situation here where i need to pass the date as sysdate
I'm trying to pass a javascript Date object to a controller that I have
I need an Http request that I can use in .Net which takes under
How Can I Turn This DateTime value into something that Sql Server 2005 won't
I am trying to convert my string formatted value to date type with format

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.