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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:13:14+00:00 2026-05-23T10:13:14+00:00

I have this date format: DAY.month.YEAR (today: 28.06.2011) I will need a Regular Expression

  • 0

I have this date format:

DAY.month.YEAR (today: 28.06.2011)

I will need a Regular Expression (RegEx) pattern for matching this date format.

Can anyone post a solution for this problem?

  • 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-23T10:13:14+00:00Added an answer on May 23, 2026 at 10:13 am

    Derived from http://www.regular-expressions.info/dates.html:

    (0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[012])\.(19|20)\d\d
    

    This matches a date in dd.mm.yyyy format from between 01.01.1900 and 31.12.2099. It will, however, still match invalid dates, because validating leap years, for example, can not be done with regex (at least not very easily).

    However, a regex is probably unnecessary. Javascript example:

    var date = "28.06.2011".split("."); // split up the date by the dots
    
    // parse the components into integers
    var day = parseInt(date[0]);
    var month = parseInt(date[1]);
    var year = parseInt(date[2]);
    
    // if you want the date in a date object, which will fix leap years (e.g. 31.02 becomes 03.03
    var date = new Date(year, month - 1, day);
    

    Note that when creating a date object, month starts at zero.

    Which method you use depends on what you need this for. If you want to find dates in a text, use the regex. If you simply want to parse the date into a date object, use the second method. Some extra validation is possibly necessary to make sure the date is valid, as the javascript Date object does not care about February having 31 days, it simply wraps over to 3. of March.

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

Sidebar

Related Questions

I have the need to display a date in this format: dd/mm/yyyy. This is
I am trying to convert the format day/month/year to month/day/year, i am using this
I have a table users with a column date_of_birth (DATE format with day, month,
The input string is '20100908041312' the format is year,month,day,Hours,minutes,seconds,time zone and I have ben
I have this: var date = new DateTime(2009, 12, 5); ... ... and need
I have 3 variables $day, $month, $year each of them have the values what
I'm in the U.S., and we usually format dates as "month/day/year". I'm trying to
I have this code that converts an array of date strings from a format
I have a date formatted like this: 2011-15 The first piece is a 4
I have an NSArray containing date/time NSStrings in the following format: 2/2/2011 2:46:39 PM

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.