-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgetTime.js
More file actions
40 lines (37 loc) · 714 Bytes
/
getTime.js
File metadata and controls
40 lines (37 loc) · 714 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
39
40
const getTime = () => {
let date = new Date();
let hour = date.getHours() + 7;
let minute = date.getMinutes();
let second = date.getSeconds();
let day = date.getDate();
let month = date.getMonth() + 1;
let year = date.getFullYear();
let dayName1 = date.getDay();
var days = [
"Minggu",
"Senin",
"Selasa",
"Rabu",
"Kamis",
"Jumat",
"Sabtu",
];
var dayName = days[dayName1];
const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
let monthName = monthNames[month - 1];
return { hour, minute, second, day, month, year, dayName, monthName };
};
module.exports = getTime;