var mydate = new date();
mydate.getyear(); //獲取當前年份(2位)
mydate.getfullyear(); //獲取完整的年份(4位,1970-????)
mydate.getmonth(); //獲取當前月份(0-11,0代表1月)
mydate.getdate(); //獲取當前日(1-31)
mydate.getday(); //獲取當前星期x(0-6,0代表星期天)
mydate.gettime(); //獲取當前時間(從1970.1.1開始的毫秒數)
mydate.gethours(); //獲取當前小時數(0-23)
mydate.getminutes(); //獲取當前分鐘數(0-59)
mydate.getseconds(); //獲取當前秒數(0-59)
mydate.getmilliseconds(); //獲取當前毫秒數(0-999)
mydate.tolocaledatestring(); //獲取當前日期
var mytime=mydate.tolocaletimestring(); //獲取當前時間
mydate.tolocalestring( ); //獲取日期與時間
日期時間指令碼庫方法列表
date.prototype.isleapyear 判斷閏年
date.prototype.format 日期格式化
date.prototype.dateadd 日期計算
date.prototype.datediff 比較日期差
date.prototype.tostring 日期轉字串
date.prototype.toarray 日期分割為陣列
date.prototype.datepart 取日期的部分資訊
date.prototype.maxdayofdate 取日期所在月的最大天數
date.prototype.weeknumofyear 判斷日期所在年的第幾周
stringtodate 字串轉日期型
isvaliddate 驗證日期有效性
checkdatetime 完整日期時間檢查
daysbetween 日期天數差
js日期時間比較函式
js日期比較 yyyy mm dd function duibi a,b else return true js時間比較 yyyy mm dd hh mi ss function comptime else if a 0 else if a 0 else var lktime new date ar...
JS日期,JS獲取當前日期時間,js日期格式化
var mydate new date mydate.getyear 獲取當前年份 2位 mydate.getfullyear 獲取完整的年份 4位,1970 mydate.getmonth 獲取當前月份 0 11,0代表1月 注意別忘了 1 mydate.getdate 獲取當前日 1 31 my...
js日期時間API
date物件 封裝乙個時間點資料,並且提供對時間或日期的api 1 建立 var date new date api 每個分量都有一段get,set方法.獲取 設定該分量的值.時間做加法 var second date.gettime 返回時間毫秒數 varnextms second 5 60 10...