Date render in data-table and new Date() is not working in IE11 & SafariJavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parseJavaScript split function not working in IEnew Date(“YYYY/MM”) not work on IE 11Date constructor returns NaN in IE, but works in Firefox and Chromejavascript date works in all browsers except iPhone/iPod TouchSending multipart/formdata with jQuery.ajaxHow does data binding work in AngularJS?Javascript + Date conversion in IE8 and Safarinew Date(year,month,day) works differently in ie10 and ie11 Dates near DST change sometimes have a time valueJavaScript new Date() Returning NaN in IE, Safarithis keyword is not working in $.each array - IE11Javascript code runs on IE11 but not on Safari and Chromemoment js diff function is failing in firefox and safari, but works fine in chrome

Old short story where the future emperor of the galaxy is taken for a tour around Earth

Did the Shuttle's rudder or elevons operate when flown on its carrier 747?

As a DM, how to avoid unconscious metagaming when dealing with a high AC character?

Can I activate an iPhone without an Apple ID?

3D-Plot with an inequality condition for parameter values

Can someone explain this logical statement?

Could the crash sites of the Apollo 11 and 16 LMs be seen by the LRO?

(algebraic topology) question about the cellular approximation theorem

How long do Apple retain notifications to be pushed to iOS devices until they expire?

What is the closed form of the following recursive function?

Adding a vertical line at the right end of the horizontal line in frac

Why linear regression uses "vertical" distance to the best-fit-line, instead of actual distance?

Does entangle require vegetation?

Postgresql numeric and decimal is automatically rounding off

Getting fresh water in the middle of hypersaline lake in the Bronze Age

What impact would a dragon the size of Asia have on the environment?

Absconding a company after 1st day of joining

Will it hurt my career to work as a graphic designer in a startup for beauty and skin care?

What caused Windows ME's terrible reputation?

How would someone destroy a black hole that’s at the centre of a planet?

how to generate correct single and double quotes in tex

Why hasn't the U.S. government paid war reparations to any country it attacked?

Why use null function instead of == []

Are there any double stars that I can actually see orbit each other?



Date render in data-table and new Date() is not working in IE11 & Safari


JavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parseJavaScript split function not working in IEnew Date(“YYYY/MM”) not work on IE 11Date constructor returns NaN in IE, but works in Firefox and Chromejavascript date works in all browsers except iPhone/iPod TouchSending multipart/formdata with jQuery.ajaxHow does data binding work in AngularJS?Javascript + Date conversion in IE8 and Safarinew Date(year,month,day) works differently in ie10 and ie11 Dates near DST change sometimes have a time valueJavaScript new Date() Returning NaN in IE, Safarithis keyword is not working in $.each array - IE11Javascript code runs on IE11 but not on Safari and Chromemoment js diff function is failing in firefox and safari, but works fine in chrome






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















My code is using datatable in which i use render date function it works in chrome but it shows NaN in IE11 & Safari. Pls help me how to resolve this issue
Here is my code snippet
Datatable



 
"data": 'starttime',
"render": function (data)
var date = new Date(data);
var month = date.getMonth() + 1;
return (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();




Js code



var date = new Date(driver_data[i].starttime);
var month = date.getMonth() + 1;
ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();









share|improve this question






















  • What is your date format ?? See stackoverflow.com/questions/43316829/…

    – Shree
    Mar 26 at 6:39











  • @Shree this the date which i get from server "2019-03-18T12:30:00.000+0530"

    – Tamara
    Mar 26 at 6:43











  • Just give date without time like 2019-03-18 and it's fine.

    – Shree
    Mar 26 at 6:50











  • @Shree i get this date from api response & i want to display date & time both as per requirement. I tried with using .replace(///g, "-"), but not working

    – Tamara
    Mar 26 at 6:52











  • So you need to split date and time and hold that on some variable and pass only date part for new date and concatenate again for final result.

    – Shree
    Mar 26 at 6:56

















0















My code is using datatable in which i use render date function it works in chrome but it shows NaN in IE11 & Safari. Pls help me how to resolve this issue
Here is my code snippet
Datatable



 
"data": 'starttime',
"render": function (data)
var date = new Date(data);
var month = date.getMonth() + 1;
return (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();




Js code



var date = new Date(driver_data[i].starttime);
var month = date.getMonth() + 1;
ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();









share|improve this question






















  • What is your date format ?? See stackoverflow.com/questions/43316829/…

    – Shree
    Mar 26 at 6:39











  • @Shree this the date which i get from server "2019-03-18T12:30:00.000+0530"

    – Tamara
    Mar 26 at 6:43











  • Just give date without time like 2019-03-18 and it's fine.

    – Shree
    Mar 26 at 6:50











  • @Shree i get this date from api response & i want to display date & time both as per requirement. I tried with using .replace(///g, "-"), but not working

    – Tamara
    Mar 26 at 6:52











  • So you need to split date and time and hold that on some variable and pass only date part for new date and concatenate again for final result.

    – Shree
    Mar 26 at 6:56













0












0








0








My code is using datatable in which i use render date function it works in chrome but it shows NaN in IE11 & Safari. Pls help me how to resolve this issue
Here is my code snippet
Datatable



 
"data": 'starttime',
"render": function (data)
var date = new Date(data);
var month = date.getMonth() + 1;
return (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();




Js code



var date = new Date(driver_data[i].starttime);
var month = date.getMonth() + 1;
ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();









share|improve this question














My code is using datatable in which i use render date function it works in chrome but it shows NaN in IE11 & Safari. Pls help me how to resolve this issue
Here is my code snippet
Datatable



 
"data": 'starttime',
"render": function (data)
var date = new Date(data);
var month = date.getMonth() + 1;
return (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();




Js code



var date = new Date(driver_data[i].starttime);
var month = date.getMonth() + 1;
ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();






javascript jquery






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 6:34









TamaraTamara

165 bronze badges




165 bronze badges












  • What is your date format ?? See stackoverflow.com/questions/43316829/…

    – Shree
    Mar 26 at 6:39











  • @Shree this the date which i get from server "2019-03-18T12:30:00.000+0530"

    – Tamara
    Mar 26 at 6:43











  • Just give date without time like 2019-03-18 and it's fine.

    – Shree
    Mar 26 at 6:50











  • @Shree i get this date from api response & i want to display date & time both as per requirement. I tried with using .replace(///g, "-"), but not working

    – Tamara
    Mar 26 at 6:52











  • So you need to split date and time and hold that on some variable and pass only date part for new date and concatenate again for final result.

    – Shree
    Mar 26 at 6:56

















  • What is your date format ?? See stackoverflow.com/questions/43316829/…

    – Shree
    Mar 26 at 6:39











  • @Shree this the date which i get from server "2019-03-18T12:30:00.000+0530"

    – Tamara
    Mar 26 at 6:43











  • Just give date without time like 2019-03-18 and it's fine.

    – Shree
    Mar 26 at 6:50











  • @Shree i get this date from api response & i want to display date & time both as per requirement. I tried with using .replace(///g, "-"), but not working

    – Tamara
    Mar 26 at 6:52











  • So you need to split date and time and hold that on some variable and pass only date part for new date and concatenate again for final result.

    – Shree
    Mar 26 at 6:56
















What is your date format ?? See stackoverflow.com/questions/43316829/…

– Shree
Mar 26 at 6:39





What is your date format ?? See stackoverflow.com/questions/43316829/…

– Shree
Mar 26 at 6:39













@Shree this the date which i get from server "2019-03-18T12:30:00.000+0530"

– Tamara
Mar 26 at 6:43





@Shree this the date which i get from server "2019-03-18T12:30:00.000+0530"

– Tamara
Mar 26 at 6:43













Just give date without time like 2019-03-18 and it's fine.

– Shree
Mar 26 at 6:50





Just give date without time like 2019-03-18 and it's fine.

– Shree
Mar 26 at 6:50













@Shree i get this date from api response & i want to display date & time both as per requirement. I tried with using .replace(///g, "-"), but not working

– Tamara
Mar 26 at 6:52





@Shree i get this date from api response & i want to display date & time both as per requirement. I tried with using .replace(///g, "-"), but not working

– Tamara
Mar 26 at 6:52













So you need to split date and time and hold that on some variable and pass only date part for new date and concatenate again for final result.

– Shree
Mar 26 at 6:56





So you need to split date and time and hold that on some variable and pass only date part for new date and concatenate again for final result.

– Shree
Mar 26 at 6:56












2 Answers
2






active

oldest

votes


















0














Older versions of Safari, IE do not support parsing of ISO format string dates and therefore you are getting the NaN errors. You could implement your own parsers or just use moment.js library which makes it a whole lot easier.




"data": 'starttime',
"render": function (data)
return moment(data).format("MM/DD/YYYY-hh:mm");




Here are more ways to format






share|improve this answer























  • how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

    – Tamara
    Mar 26 at 8:30











  • @Tamara use the library, momentjs.com/docs/#/use-it/browser

    – deviprsd
    Mar 26 at 8:31












  • Its done, thanks

    – Tamara
    Mar 26 at 8:33


















0














Try this




"title": "D.O.B",
"data": "dob",
"render": function (data)
var d = new Date(data),
month = d.getMonth() + 1,
day = d.getDate(),
year = d.getFullYear(),
hour = d.getHours(),
minutes = d.getMinutes(),
seconds = d.getSeconds();
return day + ' – ' + month + ' – ' + year + ' ' + hour + ':' + minutes + ':' + seconds;







share|improve this answer

























  • Not working, its showing Nan In IE & safari

    – Tamara
    Mar 26 at 7:37











  • The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

    – Karthik
    Mar 26 at 8:21













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351091%2fdate-render-in-data-table-and-new-date-is-not-working-in-ie11-safari%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Older versions of Safari, IE do not support parsing of ISO format string dates and therefore you are getting the NaN errors. You could implement your own parsers or just use moment.js library which makes it a whole lot easier.




"data": 'starttime',
"render": function (data)
return moment(data).format("MM/DD/YYYY-hh:mm");




Here are more ways to format






share|improve this answer























  • how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

    – Tamara
    Mar 26 at 8:30











  • @Tamara use the library, momentjs.com/docs/#/use-it/browser

    – deviprsd
    Mar 26 at 8:31












  • Its done, thanks

    – Tamara
    Mar 26 at 8:33















0














Older versions of Safari, IE do not support parsing of ISO format string dates and therefore you are getting the NaN errors. You could implement your own parsers or just use moment.js library which makes it a whole lot easier.




"data": 'starttime',
"render": function (data)
return moment(data).format("MM/DD/YYYY-hh:mm");




Here are more ways to format






share|improve this answer























  • how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

    – Tamara
    Mar 26 at 8:30











  • @Tamara use the library, momentjs.com/docs/#/use-it/browser

    – deviprsd
    Mar 26 at 8:31












  • Its done, thanks

    – Tamara
    Mar 26 at 8:33













0












0








0







Older versions of Safari, IE do not support parsing of ISO format string dates and therefore you are getting the NaN errors. You could implement your own parsers or just use moment.js library which makes it a whole lot easier.




"data": 'starttime',
"render": function (data)
return moment(data).format("MM/DD/YYYY-hh:mm");




Here are more ways to format






share|improve this answer













Older versions of Safari, IE do not support parsing of ISO format string dates and therefore you are getting the NaN errors. You could implement your own parsers or just use moment.js library which makes it a whole lot easier.




"data": 'starttime',
"render": function (data)
return moment(data).format("MM/DD/YYYY-hh:mm");




Here are more ways to format







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 8:21









deviprsddeviprsd

3033 silver badges11 bronze badges




3033 silver badges11 bronze badges












  • how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

    – Tamara
    Mar 26 at 8:30











  • @Tamara use the library, momentjs.com/docs/#/use-it/browser

    – deviprsd
    Mar 26 at 8:31












  • Its done, thanks

    – Tamara
    Mar 26 at 8:33

















  • how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

    – Tamara
    Mar 26 at 8:30











  • @Tamara use the library, momentjs.com/docs/#/use-it/browser

    – deviprsd
    Mar 26 at 8:31












  • Its done, thanks

    – Tamara
    Mar 26 at 8:33
















how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

– Tamara
Mar 26 at 8:30





how i use moment in code "var date = new Date(driver_data[i].starttime); var month = date.getMonth() + 1; ps = (month.length > 1 ? month : "0" + month) + "/" + date.getDate() + "/" + date.getFullYear() + " - " + date.getHours() + ":" + date.getMinutes();"

– Tamara
Mar 26 at 8:30













@Tamara use the library, momentjs.com/docs/#/use-it/browser

– deviprsd
Mar 26 at 8:31






@Tamara use the library, momentjs.com/docs/#/use-it/browser

– deviprsd
Mar 26 at 8:31














Its done, thanks

– Tamara
Mar 26 at 8:33





Its done, thanks

– Tamara
Mar 26 at 8:33













0














Try this




"title": "D.O.B",
"data": "dob",
"render": function (data)
var d = new Date(data),
month = d.getMonth() + 1,
day = d.getDate(),
year = d.getFullYear(),
hour = d.getHours(),
minutes = d.getMinutes(),
seconds = d.getSeconds();
return day + ' – ' + month + ' – ' + year + ' ' + hour + ':' + minutes + ':' + seconds;







share|improve this answer

























  • Not working, its showing Nan In IE & safari

    – Tamara
    Mar 26 at 7:37











  • The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

    – Karthik
    Mar 26 at 8:21















0














Try this




"title": "D.O.B",
"data": "dob",
"render": function (data)
var d = new Date(data),
month = d.getMonth() + 1,
day = d.getDate(),
year = d.getFullYear(),
hour = d.getHours(),
minutes = d.getMinutes(),
seconds = d.getSeconds();
return day + ' – ' + month + ' – ' + year + ' ' + hour + ':' + minutes + ':' + seconds;







share|improve this answer

























  • Not working, its showing Nan In IE & safari

    – Tamara
    Mar 26 at 7:37











  • The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

    – Karthik
    Mar 26 at 8:21













0












0








0







Try this




"title": "D.O.B",
"data": "dob",
"render": function (data)
var d = new Date(data),
month = d.getMonth() + 1,
day = d.getDate(),
year = d.getFullYear(),
hour = d.getHours(),
minutes = d.getMinutes(),
seconds = d.getSeconds();
return day + ' – ' + month + ' – ' + year + ' ' + hour + ':' + minutes + ':' + seconds;







share|improve this answer















Try this




"title": "D.O.B",
"data": "dob",
"render": function (data)
var d = new Date(data),
month = d.getMonth() + 1,
day = d.getDate(),
year = d.getFullYear(),
hour = d.getHours(),
minutes = d.getMinutes(),
seconds = d.getSeconds();
return day + ' – ' + month + ' – ' + year + ' ' + hour + ':' + minutes + ':' + seconds;








share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 26 at 7:33

























answered Mar 26 at 7:09









KarthikKarthik

11 silver badge2 bronze badges




11 silver badge2 bronze badges












  • Not working, its showing Nan In IE & safari

    – Tamara
    Mar 26 at 7:37











  • The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

    – Karthik
    Mar 26 at 8:21

















  • Not working, its showing Nan In IE & safari

    – Tamara
    Mar 26 at 7:37











  • The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

    – Karthik
    Mar 26 at 8:21
















Not working, its showing Nan In IE & safari

– Tamara
Mar 26 at 7:37





Not working, its showing Nan In IE & safari

– Tamara
Mar 26 at 7:37













The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

– Karthik
Mar 26 at 8:21





The code which I shared is working fine in IE & safari, I think you need to check the Date format properly

– Karthik
Mar 26 at 8:21

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351091%2fdate-render-in-data-table-and-new-date-is-not-working-in-ie11-safari%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript