1var d= new Date();
2d.getFullYear();//Get the year as a four digit number (yyyy)
3d.getMonth();//Get the month as a number (0-11)
4d.getDate();//Get the day as a number (1-31)
5d.getHours();//Get the hour (0-23)
6d.getMinutes();//Get the minute (0-59)
7d.getSeconds();//Get the second (0-59)
8d.getMilliseconds();//Get the millisecond (0-999)
9d.getTime();//Get the time (milliseconds since January 1, 1970)
1const t = new Date();
2const date = ('0' + t.getDate()).slice(-2);
3const month = ('0' + (t.getMonth() + 1)).slice(-2);
4const year = t.getFullYear();
5
6const time = `${date}/${month}/${year}`;
7
8console.log(time);
1const start = Date.now();
2/*gives the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.*/
1function toTimestamp(strDate){
2 var datum = Date.parse(strDate);
3 return datum/1000;
4}
5alert(toTimestamp('02/13/2009 23:31:30'));
6