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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:11:06+00:00 2026-05-24T00:11:06+00:00

$thisdate = ‘2011-01-18 14:52:33’; $security = preg_replace(‘/[^\d\s]/’, ”, $thisdate); echo $security; This results in

  • 0
$thisdate = '2011-01-18 14:52:33';

$security = preg_replace('/[^\d\s]/', '', $thisdate);

echo $security;

This results in 20110118 145233

How would i get rid of the space?

Thanks.

  • 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-24T00:11:06+00:00Added an answer on May 24, 2026 at 12:11 am

    your regex matches everything that is not(^) digit(\d) or space(\s)

    so if you remove the \s

    preg_replace('/[^\d]/', '', $thisdate);
    

    will replace everything except digits

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

Sidebar

Related Questions

I echo this : php> echo date(Y-m-d\TH:i:s); 2011-05-27T11:21:23 How can do with date function
I have this date and time format: 2010-05-19 07:53:30 and would like to change
I have date in this format 2011-11-02 . From this date, how can we
How can I convert this date: 2011-11-02T10:41:43+0000 Into this using JavaScript: 02/11 Thankful for
This ought to be pretty simple, maybe use a regex but I would think
how would you convert this date into c# Datetime object? Mon Mar 16 14:21:27
this page offered sample code that would be ideal for a task I'm working
I have this date format , var dateobj = 'Apr 28, 2011 6:01:23 AM';
I am trying to convert a Datetime from 29/07/2011 00:00:00 this from this format
I receive this date format from facebook and google docs: 2011-02-25T10:55:25+0000 How can I

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.