-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.js
40 lines (28 loc) · 1020 Bytes
/
testing.js
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
let date_ob = new Date();
// current date
// adjust 0 before single digit date
let date = ("0" + date_ob.getDate()).slice(-2);
// current month
let month = ("0" + (date_ob.getMonth() + 1)).slice(-2);
// current year
let year = date_ob.getFullYear();
// current hours
let hours = date_ob.getHours();
// current minutes
let minutes = date_ob.getMinutes();
// current seconds
let seconds = date_ob.getSeconds();
// prints date in YYYY-MM-DD format
console.log(year + "-" + month + "-" + date);
// prints date & time in YYYY-MM-DD HH:MM:SS format
let currentDate = year + "-" + month + "-" + date;
let currentTime = hours + ":" + minutes + ":" + seconds;
console.log(
year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds
);
// prints time in HH:MM format
console.log("currentDate", currentDate);
console.log("currentTime", currentTime);
console.log(hours + ":" + minutes);
const date = require("./api/supportingMethods/DateAndTime");
console.log("ASSA", date.getCurrentDateAndTime());