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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:38:41+00:00 2026-06-09T11:38:41+00:00

The code: new Date(‘2011-12-15 00:00:00’) is showing as NaN . How can I convert

  • 0

The code: new Date('2011-12-15 00:00:00') is showing as NaN.
How can I convert this date?
Any helps are appreciated.

My code is very straight forward. It works in Chrome but not in IE 9.

var dateText = new Date('2012-08-01 00:00:00'); 
alert(dateText.getDate().toString() + "/" + dateText.getMonth().toString() + "/" + dateText.getYear().toString());
  • 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-06-09T11:38:43+00:00Added an answer on June 9, 2026 at 11:38 am

    After some search in web, realized that the stupid IE does not understand this date format. I do not know about Safari and Firefox, but certainly this works in Chrome.

    Either I will have to use some javascript libraries like DateJS for doing this or will have to do some custom coding as below which I will never recommend. Fortunately in my case, I am sure that I will be getting the dates in the YYYY-MM-DD HH:MI:SS format.

    var dateText = '2011-12-15 00:00:00';
    alert(dateText.substring(5, 7) + "/" + dateText.substring(8, 10) + "/" + dateText.substring(0, 4));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code snippet: DateFormat formatter1; formatter1 = new SimpleDateFormat(mm/DD/yyyy); System.out.println((Date)formatter1.parse(08/16/2011)); When I
I am using this code to parse this date. It must show new date
I have this code: Date now = new Date(); // the string is in
Here's the sample code: var d = new Date(2010-06-09T19:20:30+01:00); document.write(d); On FF3.6 this will
I have just seen this in code var thisYear = (new Date()).getFullYear(); See it
I have been developing Android application where I use this code: Date d=new Date(new
Right now in my code, I have $('#StartDateTime').val(new Date(event.start).toLocaleDateString() + + (event.start).toLocaleTimeString()); which this
Following code does not work - new Date(2011-10-01) What is the format of specifying
im very new to jquery/javascript. So here goes, I found this js code for
i.e. this code startDate = new Date(timestampValue.getTime)); gives me : 2012-16-02 05:16:17 when System.out.println(timestampValue);

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.