In JavaScript, there is no easy way to get a string as “MM/dd/yyyy” from a Date type. Here is little helper function for it:
1: function getDateString(dateInput) {
2: var dDate = new Date(dateInput);
3: var sDay = dDate.getDate();
4: var sMonth = dDate.getMonth()+1;
5: var sYear = dDate.getYear();
6: var sDate = sMonth+'/'+sDay+'/'+sYear;
7: return sDate;
8:
9: }
No comments:
Post a Comment