当前时间-倒计时下载

效果:

代码:

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>倒计时js代码</title>
<style>
*
{
margin: 0;
padding: 0;
list-style: none;
}
body
{
font-size: 18px;
text-align: center;
}
.time
{
height: 30px;
padding: 200px;
}
</style>
</head>
<body>
</div>
<!--当前时间-->
<div id="show">
</div>
</body> <script>//当前时间
window.onload = function() {
var show = document.getElementById("show");
setInterval(function() {
var time = new Date();
// 程序计时的月从0开始取值后+1
var m = time.getMonth() + 1;
var t = time.getFullYear() + "-" + m + "-" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds();
show.innerHTML = t;
}, 1000);
};
</script> </html>

动态显示当前时间,带日期

效果:

代码:

//动态显示当前的时间
function GetTime(obj) {
var myDate = new Date();
var Today = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
//获取当前年
var Years = myDate.getFullYear();
//获取当前月
var Months = myDate.getMonth() + 1;
//获取当前日
var Dates = myDate.getDate(); //获取当前天是当前周的第几天
var Days = Today[myDate.getDay()]; //获取当前的时
var Hours = myDate.getHours();
//获取当前的分
var Minutes = myDate.getMinutes();
//获取当前的秒
var Seconds = myDate.getSeconds(); Months = Months < 10 ? "0" + Months : Months;
Dates = Dates < 10 ? "0" + Dates : Dates; Hours = Hours < 10 ? "0" + Hours : Hours;
Minutes = Minutes < 10 ? "0" + Minutes : Minutes;
Seconds = Seconds < 10 ? "0" + Seconds : Seconds; return Years + "年" + Months + "月" + Dates + "日" + " " + Days + " " + Hours + ":" + Minutes + ":" + Seconds;
} function showTitleInfo() {
document.getElementById("dateInfo").innerHTML = GetTime();
setTimeout("showTitleInfo()", 1000);
}
showTitleInfo();

当前时间 js的更多相关文章

  1. js获取当前时间&js 页面时钟

    js获取当前时间 //获取当前时间,格式YYYY-MM-DD function getNowFormatDate() { var date = new Date(); var seperator1 = ...

  2. js获取当前时间,js时间函数

    Js获取当前日期时间及其它操作,js时间函数 var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); ...

  3. 页面显示时间js

    //页面显示时间 <span align="left" id="OperatorTime"> </span> <script> ...

  4. js格式化时间 js格式化时间戳

    一个js格式化时间和js格式化时间戳的例子. 代码:/** * 时间对象的格式化; */Date.prototype.format = function(format) { /* * eg:forma ...

  5. 日期时间JS插件

    首先要引入基本文件:bootstrap的基本js和css文件,因为用到了jquery所以要引入jquery文件 <script src="jquery-1.11.2.min.js&qu ...

  6. MVC中的时间js格式化

    记录下我遇到的一个,MVC中post请求返回一个JSON字符串,其中包含数据库中的时间格式(如:/Date(10000000000)/),不知道怎么处理.百度的方法都不适用,经自己研究,做成了一个Jq ...

  7. js动态获取当前系统时间+js字符串转换为date日期对象

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  8. 时间js

    function DateUtil(){ this.url = ""; this.op={ partten:{mdy:"m/d/y",ymd:"y/m ...

  9. 时间js转换方法Date("149...") 转成 2016-7-12 21:23:34 009

     function timeFormatter(value) {     var da = new Date(parseInt(value.replace("/Date(", &q ...

随机推荐

  1. linux系统目录详解

    Linux目录结构包括文件类型和一些重要的文件子目录. linux文件系统的最顶端是/,称为linux的root,所有的目录.文件.设备都在/之下.文件类型linux有四种基本文件系统类型:普通文件. ...

  2. v8 javascript engine

    https://code.google.com/p/v8-wiki/wiki/BuildingWithGYP vs2013git v8 http://github.com/v8/v8-git-mirr ...

  3. Ubuntu下安装mysql-python包

      sudo apt-get install libmysqld-dev sudo apt-get install libmysqlclient-dev sudo apt-get install py ...

  4. ARM学习笔记5——程序状态寄存器

    当前程序状态寄存器CPSR可以在任何位处理器模式下被访问,它包含条件码标志.中断控制.当前处理器模式以及其他状态和控制信息.CPSR的结构图如下: 一.条件标志位 CPSR最高4位:N(Negativ ...

  5. 18. 4Sum

    #include <string>#include <stack>#include <vector>#include <map>#include < ...

  6. MySQL数据库建立外键失败的原因总结

    在MySQL数据库创建外键时,经常会发生一些错误,这是一件很令人头疼的事.一个典型的错误就是:Can’t create table... 的错误.在很多实例中,这种错误的发生都是因为mysql一直以来 ...

  7. hdoj 1047 Integer Inquiry

    Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  8. CSS实现圆角,三角,五角星,五边形,爱心,12角星,8角星,圆,椭圆,圆圈,八卦

    转自:http://blog.csdn.net/chenhongwu666/article/details/38905803 CSS实现圆角,三角,五角星,五边形,爱心,12角星,8角星,圆,椭圆,圆 ...

  9. (4/18)重学Standford_iOS7开发_框架和带属性字符串_课程笔记

    第四课(干货课): (最近要复习考试,有点略跟不上节奏,这节课的内容还是比较重要的,仔细理解掌握对今后的编程会有很大影响) 本节课主要涉及到Foundation和UIKit框架,基本都是概念与API知 ...

  10. 3proxy代理软件文档说明

    官方英文原版说明:http://www.3proxy.ru/howtoe.asp 配置文件的简要说明:如果你的英文理解力好,可以试着研究一下他的手册. 以实例说明吧 nscache 65536域名解析 ...