var dt = new Date(temper.replace(/-/,\"/\")) a" />
How to convert time type into string in js
Method 1:
var temper="2009-6-28 15:23"
p>
var dt = new Date(temper.replace(/-/,"/"))
alert(dt)
Method 2:
< p>function ConvertDateFromString(dateString) {if (dateString) {
var arr1 = dateString.split(" ");
var sdate = arr1[ 0].split('-');
var date = new Date(sdate[0], sdate[1], sdate[2]);
return date; < /p>
}
}
Get the total number of days in a month:
function GetDayInMonth(day) {
var today = day;
var year = today.getFullYear();
if (year < 2000) year += 1900; // Y2K fix
var month = today.getMonth();
var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
monarr[1] = 29;
return monarr[month];
}