- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path41_date.js
More file actions
Latest commit
38 lines (33 loc) · 688 Bytes
/
Copy path41_date.js
File metadata and controls
38 lines (33 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Date
constmonths=[
'January',
'February',
'March',
'April',
'May ',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];
constdays=['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'];
constdate=newDate();
console.log(date);//today : 2020-10-18T12:05:07.047Z
// getMonth
constmonth=date.getMonth();
console.log(months[month]);
// getDay
constday=date.getDay();
console.log(days[day]);
// getDate
console.log(date.getDate());
// getfullyears
console.log(date.getFullYear());
// example
constsentence=`${days[day]}, ${date.getDate()}${
months[month]
}${date.getFullYear()}`;
console.log(sentence);