平面設計
環藝設計
工業設計
CG插畫
網頁UI
攝影
藝術
名人堂
空間設計
UI/UX
網頁設計
電商視覺
工業/產品
插畫動漫
文章
平面教程
網頁教程
多媒體教程
印前技術
PS教程
Illustrator教程
矢量素材
矢量標志
PSD素材
PNG圖標素材
GIF圖標素材
其他素材
壁紙下載
PS素材
平面征集
工業征集
環境藝術
其它征集
設計揭曉
時間和日期的各種格式的特效代碼
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><TITLE>emu's date simple date formatter</TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT="emu"><META NAME="Keywords" CONTENT="date formatter format emu"><META NAME="Description" CONTENT="A function to format Date object into String"></HEAD><BODY><SCRIPT LANGUAGE="JavaScript"><!--Date.prototype.format = function (format){if (format == null) format = "yyyy/MM/dd HH:mm:ss.SSS";var year = this.getFullYear();var month = this.getMonth();var sMonth = ["January","February","March","April","May","June","July","August","September","October","November","December"][month];var date = this.getDate();var day = this.getDay();var hr = this.getHours();var min = this.getMinutes();var sec = this.getSeconds();var daysInYear = Math.ceil((this-new Date(year,0,0))/86400000);var weekInYear = Math.ceil((daysInYear+new Date(year,0,1).getDay())/7);var weekInMonth = Math.ceil((date+new Date(year,month,1).getDay())/7);return format.replace("yyyy",year).replace("yy",year.toString().substr(2)).replace("dd",(date<10?"0":"")+date).replace("HH",(hr<10?"0":"")+hr).replace("KK",(hr%12<10?"0":"")+hr%12).replace("kk",(hr>0&&hr<10?"0":"")+(((hr+23)%24)+1)).replace("hh",(hr>0&&hr<10||hr>12&&hr<22?"0":"")+(((hr+11)%12)+1)).replace("mm",(min<10?"0":"")+min).replace("ss",(sec<10?"0":"")+sec).replace("SSS",this%1000).replace("a",(hr<12?"AM":"PM")).replace("W",weekInMonth).replace("F",Math.ceil(date/7)).replace(/E/g,["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][day]).replace("D",daysInYear).replace("w",weekInYear).replace(/MMMM+/,sMonth).replace("MMM",sMonth.substring(0,3)).replace("MM",(month<9?"0":"")+(month+1));}var d = new Date();alert(d.format());//default formatalert(d.format("MM-dd-yyyy"));alert(d.format("dd/MM/yy"));alert(d.format("dd\\MM\\yyyy HH:mm ss.SSS"));alert(d.format("yyyy年MM月dd日 HH時mm分ss.SSS秒"));alert(d.format("yyyy年MM月dd日 E HH(0~23)時mm分ss.SSS秒"));alert(d.format("yyyy年MM月dd日 E KK(0~11)時mm分ss.SSS秒 a"));alert(d.format("yyyy年MM月dd日 E hh(1~12)時mm分ss.SSS秒 a"));alert(d.format("yyyy年MM月dd日 E kk(1~24)時mm分ss.SSS秒 今年的第D天,第w周,MMMM這個月的第W周,MMM這個月的第F個E"));//--></SCRIPT></BODY></HTML>
[Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]
再來一個中文顯示的
<SCRIPT LANGUAGE="JavaScript"><!--String.prototype.toCHS=function(){return this.replace(/\d/g, function(a){return "零一二三四五六七八九".charAt(parseInt(a))});}Number.prototype.toCHS=function(){return((this>19?Math.floor(this/10):"")+(this>9?("十"):"")+(this%10==0&&this>0?"":this%10)).toCHS();}Date.prototype.toCHS=function(){with(this)return(getFullYear()+"").toCHS()+"年"+(getMonth()+1).toCHS()+"月"+getDate().toCHS()+"日"+getHours().toCHS()+"時"+getMinutes().toCHS()+"分"+getSeconds().toCHS()+"秒";}alert(new Date().toCHS());//--></SCRIPT>
優秀海報設計精選集(8)海報設計
充滿自然光線!32平米精致小公寓設計裝修設計
親愛的圖書館 | VERSE雜志版式設計版式設計
19款漂亮的jQuery Slider焦點圖代碼
flash廣告代碼:帶文字說明的焦點圖輪換代碼
關于我們 廣告投放 版權聲明 免責聲明網站地圖 友情鏈接 留言反饋
版權所有 2006-2021 設計之家(m.btde9.cn)Copyright ? 2006-2021 m.btde9.cn All rights reserved.