-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
46 lines (43 loc) · 1.63 KB
/
notes.txt
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
41
42
43
44
45
46
//new date()
------------------------
//Get method
************************
==>//toDateString() //returns the date portion of date object
const a = new Date();//date object-a fixed
console.log(a.toDateString());
//getDate()
const a = new Date();//date object-a fixed returns date
console.log(a.getDate());
//getFullyear()
const a = new Date();//date object-a fixed returns fullyear
console.log(a.getFullyear());
//getMonth()
const a = new Date();//date object-a fixed returns month
console.log(a.getMonth());
//getDay() returns day of the week of day(0 to 6)
//getHours() returns the hours(0 to 23)
//getMinutes() returns minutes(0 to 59)
//getSeconds() returns getSeconds
//getMilliseconds() returns milliseconds(0 to 999)
//getTime() return the number of milliseconds since jan 1
const e=new Date();
console.log(e.getDay());
console.log(e.getHours());
console.log(e.getMinutes());
console.log(e.getSeconds());
console.log(e.getMilliseconds());
console.log(e.getTime());
//javascript date set method:-
setDate() //sets the day of the month of a date
setFullyear() //sets full year of the date and also month and day
setHours() //set the hours of a date and also sets minutes ,seconds and milliseconds
setMilliseconds() //sets the milliseconds of date
setMinutes() //set the minutes ,seconds and milliseconds
setSeconds() //sets the seconds,milliseconds of date
setMonth() //sets the month of date ,day of the month
setTime() //sets date and time by adding or subracting a specified number of milliseconds(to/from mid of jan 1 1990)
const f = new Date();
console.log(f.setDate(27));
**********************************
Javascript Array Methods
************************