獲取當前時間

2022-08-30 13:36:08 字數 571 閱讀 4449

//   a.gethours();   獲取當前小時

//   a.getminutes();     獲取當前分鐘

//   a.getfullyear();      獲取當年年份

//   a.getdate();     獲取當前日期

//   a.getday();       獲取當年星期,不過是以數字表示,月份比中國少1,一定要加上

var c = ['星期一','星期二','星期三','星期四','星期五','星期六','星期天'];

function aa()

if(a.getminutes()<10)

if(a.getseconds()<10)

if(b<10)

if(a.getdate()<10)

e.innerhtml=i+":"+j;

f.innerhtml=k;

g.innerhtml=a.getfullyear().tostring()+"年"+l+"月"+m+"日";

h.innerhtml=d;

settimeout("aa()",1000)

}aa();

獲取當前時間

獲取日期 時間 datetime.now.tostring 2008 9 4 20 02 10 datetime.now.tolocaltime tostring 2008 9 4 20 12 12 獲取日期 datetime.now.tolongdatestring tostring 2008年9...

獲取當前時間

直接上可以執行的 檔案 獲取當前時間.cpp 方案 time 優點 僅使用c標準庫 缺點 只能精確到秒級 include time.h include stdio.h int main void 方案二getlocaltime 優點 能精確到毫秒級 缺點 使用了windows api include...

獲取當前時間

使用函式 date 實現 顯示的格式 年 月 日 小時 分鐘 妙 相關時間引數 a am 或是 pm a am 或是 pm d 幾日,二位數字,若不足二位則前面補零 如 01 至 31 d 星期幾,三個英文本母 如 fri f 月份,英文全名 如 january h 12 小時制的小時 如 01 至...