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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:08:18+00:00 2026-05-22T15:08:18+00:00

I am trying to extract a date from a string variable and was hoping

  • 0

I am trying to extract a date from a string variable and was hoping to get some help.

$editdate = "Content last modified on 17 May 2011 at 23:13";

from this string, I am trying to extract 17 May 2011, please keep in mind that the date will vary and the code needs to be able to extract any date in this format, DD MMM YYYY.

I thought of using preg_match to do this but I couldn’t come up with a proper regex pattern that would extract the date properly.

Is this possible to do with regex or should I use a different function?

Thanks for the help !

  • 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-22T15:08:19+00:00Added an answer on May 22, 2026 at 3:08 pm

    Try:

    $timestamp = strtotime( str_replace( array("Content last modified ", "at"), "", $editdate ) );
    

    Which will leave you with an epoch time stamp that you can then output however you like using date()

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

Sidebar

Related Questions

I'm trying to extract the domain name from a string in C#. You don't
I'm trying to extract the date/time when a picture was taken from the CR2
I am trying to extract publisher information from a string. It comes in various
I'm trying to use ruby and mongoid in order to extract some data from
Im trying to extract a line from wget's result but having trouble with it.
I am trying to extract a table of values from an excel (2003) spreadsheet
I'm trying to extract all matches from a EBML definition, which is something like
I'm trying to parse a html page and extract 2 values from a table
I'm trying to figure out how to extract dates from unstructured text using Ruby.
I am trying to extract data from XML. I generated C# classes using XSD

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.