Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Datatables date format problem

Posted on 2013-12-10
Medium Priority
Last Modified: 2013-12-10
I'm using datatables with my project and i'm trying to display several dates.

It works fine in Chrome but not in firefox. In firefox the dates are shown as Nan

Any ideas

Here's a link
Question by:maddisoncr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 25

Expert Comment

by:Lee Savidge
ID: 39708374
Just so you know, in IE 11 it also displays NaN for the dates. NaN stands for "Not a Number".

I don't think this problem is with the date handling code because this:

function getValue()
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1;
var curr_year = d.getFullYear();
var newdate= (curr_date + "/" + curr_month + "/" + curr_year);

<h1 id="myHeader" onclick="getValue()">Click me!</h1>


Open in new window

This works just fine in FF and IE 11.

Hope this helps.
LVL 82

Accepted Solution

leakim971 earned 2000 total points
ID: 39708392
replace :
							var d = new Date (data);
							var curr_date = d.getDate();
							var curr_month = d.getMonth() + 1;
							var curr_year = d.getFullYear();

							var newdate= (curr_date + "/" + curr_month + "/" + curr_year);
							if( (data)){
								return newdate;
							return "";	

Open in new window

by :
							if(data) {
								var d = data.split(/-|\s/);
								var curr_date = d[2];
								var curr_month = d[1];
								var curr_year = d[0];

								return curr_date + "/" + curr_month + "/" + curr_year;
								return "";	

Open in new window


Author Comment

ID: 39708533
thank you guys for the quick responses :-)

Featured Post

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question