Parsing date from string to cultural format
string timeFrameFromDate=date;
lstItem["FromDate"] = DateTime.ParseExact(timeFrameFromDate, "dd/M/yyyy", CultureInfo.InvariantCulture);
Date Format Output will be like this 31/12/2017
And Use below code to convert date in different format
function getFormattedDate(formatedDate) {
var year = formatedDate.getFullYear();
var month = (1 + formatedDate.getMonth()).toString();
month = month.length > 1 ? month : '0' + month;
var day = formatedDate.getDate().toString();
day = day.length > 1 ? day : '0' + day;
return day + '/' + month + '/' + year;
}
string timeFrameFromDate=date;
lstItem["FromDate"] = DateTime.ParseExact(timeFrameFromDate, "dd/M/yyyy", CultureInfo.InvariantCulture);
Date Format Output will be like this 31/12/2017
And Use below code to convert date in different format
function getFormattedDate(formatedDate) {
var year = formatedDate.getFullYear();
var month = (1 + formatedDate.getMonth()).toString();
month = month.length > 1 ? month : '0' + month;
var day = formatedDate.getDate().toString();
day = day.length > 1 ? day : '0' + day;
return day + '/' + month + '/' + year;
}
No comments:
Post a Comment