Skip to content Skip to sidebar Skip to footer

Convert String To Date Without Considering Timezone

From service I get date string in format 'yyyy-mm-dd' (eb, '2017-09-14') In JavaScript, I convert this string to Date like as mentioned below: new Date('2017-09-14') It works just

Solution 1:

YOu can do it like this

var d=newDate(date value);
var actualDate=d.getDate();
var actualMonth=d.getMonth()+1;
var actualYear=d.getFullYear();    
var formattedDate=actualDate + '/' + actualMonth + '/' + actualYear;

You can save it to any format

Post a Comment for "Convert String To Date Without Considering Timezone"