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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:04:41+00:00 2026-05-28T02:04:41+00:00

I want to parse date in my page to Javascript’s Date . So I

  • 0

I want to parse date in my page to Javascript’s Date.

So I have this in my page

<span>01-07-2012 01:04 PM</span>

And I have Javascript code that parses this value to date

var tagText = $(this).html();
var givenDate = new Date(tagText);
alert(givenDate);

And here is what I get in different browsers

IE:

Sat Jan 7 13:04:00 UTC+0400 2012

Chrome:

Sat Jan 07 2012 13:04:00 GMT +0400 (Caucasus Standard Time)

Firefox:

Invalid Date

Why Firefox doesn’t recognize my date? What I must change to make it work with all major browsers?

Here is jsfiddle http://jsfiddle.net/mgER5/1/

  • 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-28T02:04:42+00:00Added an answer on May 28, 2026 at 2:04 am

    try this:

    var tagText = $(this).html();
    tagText = tagText.replace(/-/g, '/');
    var givenDate = new Date(tagText);
    alert(givenDate);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to parse this date: 2009-08-24T05:20:00 I have tried this, but doesn't work:
I have date formats like this which I want to parse -- 02 September
I have old code that uses new Date(dateString) to parse a date string. Compiling
I have a date string and I want to parse it to normal date
I want to parse a java.util.Date from a String. I tried the following code
I have a long list of dates that i want to parse, they are
I want to parse a Date chosen by user: var ds = 11 /
I want to parse strings like this into a consistent structured date range: Monday
Let's say I have a report page that can be customized via Javascript. Say
I want to be able to parse this date-time format 2011-12-02T16:18:12.479-05:00 into an mm/dd/yy

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.