使用js输出当前系统时间,包括年月日星期时分秒,并且用中文显示出来,大概效果如图所示
具体实现的代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
window.onload = function () {
function getyears(year) {
var a = parseInt(year / 1000);
var b = parseInt(year % 1000 / 100);
var c = parseInt(year % 100 / 10);
var d = parseInt(year % 10);
var arr = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
return arr[a] + arr[b] + arr[c]