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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:03:55+00:00 2026-05-25T18:03:55+00:00

What is an easy way to check if a value is a valid date,

  • 0

What is an easy way to check if a value is a valid date, any known date format allowed.

For example I have the values 10-11-2009, 10/11/2009, 2009-11-10T07:00:00+0000 which should all be recognized as date values, and the values 200, 10, 350, which should not be recognized as a date value. What is the simplest way to check this, if this is even possible? Because timestamps would also be allowed.

  • 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-25T18:03:56+00:00Added an answer on May 25, 2026 at 6:03 pm

    Would Date.parse() suffice?

    See its relative MDN Documentation page.

    Date.parse returns a timestamp if string date is valid. Here are some use cases:

    // /!\ from now (2021) date interpretation changes a lot depending on the browser
    Date.parse('01 Jan 1901 00:00:00 GMT') // -2177452800000
    Date.parse('01/01/2012') // 1325372400000
    Date.parse('153') // NaN (firefox) -57338928561000 (chrome)
    Date.parse('string') // NaN
    Date.parse(1) // NaN (firefox) 978303600000 (chrome)
    Date.parse(1000) // -30610224000000 from 1000 it seems to be treated as year
    Date.parse(1000, 12, 12) // -30610224000000 but days and month are not taken in account like in new Date(year, month,day...)
    Date.parse(new Date(1970, 1, 0)) // 2588400000
    // update with edge cases from comments
    Date.parse('4.3') // NaN (firefox) 986248800000 (chrome)
    Date.parse('2013-02-31') // NaN (firefox) 1362268800000 (chrome)
    Date.parse("My Name 8") // NaN (firefox) 996616800000 (chrome)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to check to see if a date/time is valid you
Is there an easy way to check a container if it contains a value,
Is there a quick and easy way to check if any of my $_POST
I am looking for an easy way to check if an object in C#
Is there an easy way within C# to check to see if a DateTime
I'm using the following code to check if a valid date has been typed
What is an easy way to check if directory 1 is a subdirectory of
Using Java is there an easy way to check whether a given file conforms
I'm using C# Windows Forms. Is there an easy way to check if there
Is there an easy way to iterate over an associative array of this structure

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.