<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
//取得当前时间
function getTimeStamp()
{
// 声明变量。
var d, s;
// 创建 Date 对象。
d = new Date();
s = d.getFullYear() + "-";
s += ("0"+(d.getMonth()+1)).slice(-2) + "-";
s += ("0"+d.getDate()).slice(-2) + " ";
s += ("0"+d.getHours()).slice(-2) + ":";
s += ("0"+d.getMinutes()).slice(-2) + ":";
s += ("0"+d.getSeconds()).slice(-2) + ".";
s += ("00"+d.getMilliseconds()).slice(-3);
return s;
}
//alert(getTimeStamp());
/************************************************************************/
//取得当前时间
function curDateTime(){
var d = new Date();
//alert(d);
var year = d.getYear();
var month = d.getMonth()+1;
var date = d.getDate();
var day = d.getDay();
var hours = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();
var ms = d.getMilliseconds();
var curDateTime= year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds;
return curDateTime;
}
//alert(curDateTime());
/************************************************************************/
//取得当前的时间戳
function timestamp() {
var timestamp = Date.parse(new Date());
return timestamp;
}
//alert(timestamp());
/************************************************************************/
/**
* 获得当前的日期
*
* @return {}
*/
function getCurrentDate() {
var userAgent = navigator.userAgent.toLowerCase();
//判断是否为google的浏览器
var chrome = /chrome/.test(userAgent);
var currentDate = new Date();
// 因IE的年为2008和FF为108,判断
var currentYear = currentDate.getYear();
//if ($.browser.mozilla || chrome) {
//currentYear += 1900;
//}
var currentDateStr = currentYear + '-' + (currentDate.getMonth() + 1) + '-'
+ currentDate.getDate()+ ' '+currentDate.getHours()+ ':'+currentDate.getMinutes()+ ':'+currentDate.getSeconds();
return currentDateStr;
};
//alert(getCurrentDate());
</SCRIPT>
</BODY>
</HTML>