10 examples of 'javascript date get day' in JavaScript

Every line of 'javascript date get day' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
157getDay() { return !(this.value instanceof Date) ? NaN : this.value.getDay(); }
67getDayOfWeek(date: Date): number {
68 return date.getDay();
69}
124function getDay(str){
125 var oDate = new Date(str);
126 var oDay = oDate.getDate();
127 return getzf(oDay);
128}
118function getDay(day: number) {
119 const t = new Date(time);
120 t.setDate(t.getDate() + day);
121 const m = t.getMonth() + 1;
122 return t.getFullYear() + '-' + m + '-' + t.getDate();
123}
40static dayOfWeek (date) {
41 var day = date.getDay()
42 return {
43 1: 'Mon',
44 2: 'Tue',
45 3: 'Wed',
46 4: 'Thu',
47 5: 'Fri',
48 6: 'Sat',
49 0: 'Sun'
50 }[day]
51}
125export function getFirstDayOfMonth(day) {
126 return new Date(day.getFullYear(), day.getMonth(), 1, 12);
127}
96function getDaysInMonth(d) {
97 var resultDate = getFirstDayOfMonth(d);
98 resultDate.setMonth(resultDate.getMonth() + 1);
99 resultDate.setDate(resultDate.getDate() - 1);
100 return resultDate.getDate();
101}
42export function getDaysInMonth (d) {
43 const resultDate = getFirstDayOfMonth(d);
44
45 resultDate.setMonth(resultDate.getMonth() + 1);
46 resultDate.setDate(resultDate.getDate() - 1);
47
48 return resultDate.getDate();
49}
32function checkDay(){
33 var pre_time = localStorage['today'];
34 var now_time = new Date().getDay();
35 if (pre_time == now_time){
36 return false;
37 }else{
38 return now_time;
39 }
40}
26function getPreviousMonday(date) {
27 var date = new Date(date); //clone date to avoid changes in the parameter
28 var dayOfWeek = date.getDay();
29 var monday = date.getDate() - dayOfWeek;
30 monday += (dayOfWeek == 0 ? -6:1); // adjust when day is Sunday
31
32 return new Date(date.setDate(monday));
33}

Related snippets