📜  如何在 javascript 代码示例中编写一个程序来确定自 1970 年 1 月 1 日午夜以来的分钟数

📅  最后修改于: 2022-03-11 15:03:18.303000             🧑  作者: Mango

代码示例1
var todayDate = new Date();
var Todaymilli = todayDate.getTime();
var todayMin = todayDate.getMinutes();
var diff = Todaymilli - todayMin;
var diffMin = diff/(1000*60*60);
var accurateMin = Math.floor(diffMin);

 
document.write("Current Date: " + todayDate);
document.write("
Elapsed milliseconds since midnight, Jan 1, 1970: " + Todaymilli); document.write("
Elapsed minutes since midnight, Jan 1, 1970: " + accurateMin)