zoukankan
html css js c++ java
js 当前时间
js 当前时间
1
<
script language
=
"
JavaScript
"
>
2
Date.prototype.format
=
function
(format)
//
author: meizz
3
{
4
var
o
=
{
5
"
M+
"
:
this
.getMonth()
+
1
,
//
month
6
"
d+
"
:
this
.getDate(),
//
day
7
"
h+
"
:
this
.getHours(),
//
hour
8
"
m+
"
:
this
.getMinutes(),
//
minute
9
"
s+
"
:
this
.getSeconds(),
//
second
10
"
q+
"
: Math.floor((
this
.getMonth()
+
3
)
/
3),
//
quarter
11
"
S
"
:
this
.getMilliseconds()
//
millisecond
12
}
13
if
(
/
(y+)
/
.test(format)) format
=
format.replace(RegExp.$
1
,
14
(
this
.getFullYear()
+
""
).substr(
4
-
RegExp.$
1
.length));
15
for
(
var
k
in
o)
if
(
new
RegExp(
"
(
"
+
k
+
"
)
"
).test(format))
16
format
=
format.replace(RegExp.$
1
,
17
RegExp.$
1
.length
==
1
?
o[k] :
18
(
"
00
"
+
o[k]).substr((
""
+
o[k]).length));
19
return
format;
20
}
21
alert(
new
Date().format(
"
yyyy-MM-dd hh:mm:ss
"
));
22
<
/
script>
查看全文
相关阅读:
hibernate的缓存机制
[poj 3159]Candies[差分约束详解][朴素的考虑法]
POJ 2773 Happy 2006
给定一个循环链表,实现一个算法返回这个环的开始结点
使用jQuery创建模态窗口登陆效果
实战数据结构(3)_两个单链表间的合并操作
sql的强大功能(看一条sql解决的复杂业务)
uva 10905 Children's Game (排序)
JFinal学习 & Gradle配置续 & Tomcat配置
Gradle项目学习 & HttpAsyncClient学习 & CountDownLatch学习
原文地址:https://www.cnblogs.com/u_xiaomo/p/1584164.html
最新文章
【转】深入 Python :Dive Into Python 中文版
【转】面向对象的三个基本特征 和 五种设计原则
简明 Python 教程--学习记录
【转】刚发现一个linux在线文档库。很好很强大。
【转】无需root Android 4.4现已支持显示电量百分比
【转】如何将FLAC格式转为MP3格式
【转】电信100M光纤无线下载速度仅为5MB/秒的困惑
【转】终于搞明白什么叫双卡双待双模双通手机
0-1分布(伯努利分布)、n 重伯努利分布(二项分布)
0-1分布(伯努利分布)、n 重伯努利分布(二项分布)
热门文章
依**相等/成立
依**相等/成立
zlib minizip 实现解压zip
【读书笔记】—— 西方人文社科经典
【读书笔记】—— 西方人文社科经典
【读书笔记】—— 《马克思恩克斯全集》
【读书笔记】—— 《马克思恩克斯全集》
【读书笔记】 —— 金融
8种排序算法--直接插入排序
HTML5 RPG游戏示例
Copyright © 2011-2022 走看看