Returns the day of the week and the day of the week of the javascript string.
The format of the date string returned by the server is as follows:
12:23:46 pm-01-19 pm-01-19 pm-01-19 pm-01-16 pm
It is required that the date of the week be converted into the following format:
First, convert the string to the date format.
Var str = '1970-01-20 12:03:12 '; dateStr = dateStr. replace (/-/g,'/'); var date = new Date (dateStr );
OK. Call the getDay () method after converting to the date format to determine the day of the week.
Var day = date. getDay ();
The complete method is as follows:
Function getDayOfWeek (dateStr) {var dayOfWeek = ""; dateStr = dateStr. replace (/-/g, '/'); var date = new Date (dateStr); switch (date. getDay () {case 0: dayOfWeek = 'sunday'; break; case 1: dayOfWeek = 'monday'; break; case 2: dayOfWeek = 'tues'; break; case 3: dayOfWeek = 'wedne'; break; case 4: dayOfWeek = 'thurs'; break; case 5: dayOfWeek = 'Friday'; break; case 6: dayOfWeek = 'satur'; break;} return dayOfWeek ;}
O (distinct _ distinct) O ~