This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 計算已經服役天數 */ | |
var now = new Date(); | |
var day = new Date(2009,9-1,1); | |
/* 這個是入伍日期,上面的寫法是:我在 2007 年 10 月 17 入伍 */ | |
day = (now.getTime()- day.getTime())/(24*60*60*1000); | |
/* 現在時間減去入伍時間,為 Unix 系統時間,毫秒 */ | |
day = Math.ceil(day); | |
/*傳回指定數字或運算式的最小整數 */ | |
if (day < 0) | |
document.write("距離國軍Online 登入還有<strong>" + day*-1 + "</strong> 天"); | |
else | |
document.write("已經在國軍Online <strong>" + day + "</strong> 天"); |
2 comments:
唉呀....要去當兵囉...
真是太晚知....應該要找你喝一杯的
等你休假囉
哈,沒問題!