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

The Archive Base Latest Questions

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

Ok, here goes a newbie question: //function removes characters and spaces that are not

  • 0

Ok, here goes a newbie question:

//function removes characters and spaces that are not numeric.

// time = "2010/09/20 16:37:32.37"
function unformatTime(time) 
{       

    var temp = "xxxxxxxxxxxxxxxx";

    temp[0] = time[0];
    temp[1] = time[1];
    temp[2] = time[2];
    temp[3] = time[3];
    temp[4] = time[5];
    temp[5] = time[6];
    temp[6] = time[8];
    temp[7] = time[9];
    temp[8] = time[11];
    temp[9] = time[12];
    temp[10] = time[14];
    temp[11] = time[15];
    temp[12] = time[17];
    temp[13] = time[18];
    temp[14] = time[20];
    temp[15] = time[21];   


}

In FireBug I can see that the characters from time are not assigned to temp?
Do i have to use a replace() function to do something like this in JS?

Thank You.

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

    [^\d] is the regular expression for “not digit”.

    In more detail,

    [] represents a “character class”, or group of characters to match on.
    \d is a shortcut for 0-9, or any digit.
    ^ in a character class negates the class.

    function unformat(t)
    {
       return t.replace( /[^\d]/g, '' );
    }
    

    You can’t access a string like that in one of the major browsers, anyway. You would need to use str.charAt(x).

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

Sidebar

Related Questions

Ok, first question so here goes, A function that runs on activation of a
I had much luck last time I submitted a question so here goes: I
Here goes a newbie question: Create a new project in Xcode: File > New
This is a brain-dead newbie question, but here goes: What determines what files get
Here goes newbie question number 5, but I don't have a teacher.. so.. anyhow
This is sort of SQL newbie question, I think, but here goes. I have
Sorry in advance for a potentially dumb newbie question, but here goes. I am
I'm a jquery newbie... still learning the framework.... and here goes my query... The
A slightly archaic question I'm afraid but here goes: I have a program which
Okay this is definitely a n00b question but here goes. The way I understand

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.