如何获取自JavaScript时代以来的时间和日期?
要获取自JavaScript时代以来的时间和日期,您可以尝试运行以下代码-
示例
<html>
<head>
<title>JavaScript Clone Date</title>
</head>
<body>
<script>
var current_date, epocDate;
current_date = new Date();
document.write("Current Date: "+current_date);
var epocDate = new Date(new Date().getTime() / 1000);
document.write("<br>Since epoch: "+epocDate);
</script>
</body>
</html>输出结果
Current Date: Mon May 28 2018 09:23:11 GMT+0530 (India Standard Time) Since epoch: Sun Jan 18 1970 21:47:59 GMT+0530 (India Standard Time)
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短