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

  • Home
  • SEARCH
  • 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 5932881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:53:46+00:00 2026-05-22T14:53:46+00:00

Format date: MMM D[,] YYYY [,] – optional comma and may be some space

  • 0

Format date: MMM D[,] YYYY

[,] – optional comma and may be some space . Example:

Nov 12,     2000 - true
Nov 12 2000 - true
Nov 12, 2000 - true
Nov      12,    2000 true

My regExp:/^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\ *(\d{1,2})\,? *(\d{4})$/
But if value – March 2010 all if true

My function for check value

function checkDateWithStringMonth1(value) {
        //reset
        resetDate();
        //set min and max date
        var minYear = 1900;
        //var maxYear = (new Date()).getFullYear();
        // regular expression to match required date format
        re = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\ *(\d{1,2})\,? *(\d{4})$/;
        //check correct
        if (value != '') {
            if (regs = value.match(re)) {
               if (regs[2] < 1 || regs[2] > 31) {
                    return false;
                }
                if(regs[3] < minYear){return false;}
            } else { return false; }
        } else { return false; }
        //assign

        return true;        
    }
  • 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-22T14:53:47+00:00Added an answer on May 22, 2026 at 2:53 pm
    /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+(\d{1,2}),?\s+(\d{4})$/
    

    Differences from your original:

    • \s instead of [space] to handle different kinds of whitespace
    • + instead of *: * means 0 or more, you want 1 or more
    • No need to escape ,.

    Edit: To accomodate dates with no space after the comma:

    /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+(\d{1,2})(?:,|\s)\s*(\d{4})$/
    
    • (?: stats a non-capturing group.
    • (?:,|\s)\s*: Allow for a comma or a whitespace character, and then possibly more whitespace.

    Test:

    var dates = ["Nov 12,     2000", "Nov 12 2000", "Nov 12, 2000", "Nov      12,    2000", "Nov 12,2000"],
        regex = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+(\d{1,2})(?:,|\s)\s*(\d{4})$/;
    
    dates.map(function (d) { return regex.test(d); });
    // => [true, true, true, true, true]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a repeater control I've Eval binding as: <%#Eval(PubDate, {0:dd-MMM-yyyy})%> But date time format
I have a date format pattern: MMM yyyy And want that: if the month
So I had to convert a date in the format of (MM-dd-yyyy) to (dd-MMM-yyyy).
I want the date format as dd-MMM-yyyy. My code is: String v_date_str=Sun Mar 06
I'm parsing a date which is in format EEE, dd MMM yyyy HH:mm:ss Z
I have a Date format: 2009-08-10T16:03:03Z that I want to convert to: @MMM dd,
i want to format date to string in hql select, for example i have
How do you format the date time to just date? For example, this is
I am storing the dates in a SQLite database in this format: d-MMM-yyyy,HH:mm:ss aaa
I am retrieving date from MySQL in the format yyyy/mm/dd 00:00:00. I want to

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.