輸出當月的日曆

2021-06-19 21:24:53 字數 820 閱讀 6351

專案中碰到乙個需要手動輸入月份,然後頁面輸出當月日曆的功能,開始想用js來做,發現沒辦法做。之後,因為還需要設定每個日期的節假日,想到之前做過萬年曆。剛好用上了,就通過程式演算法來控制,無論選擇那個月,都能顯示日曆。程式碼如下:

string strdate = webutils.getparameter("condition");

int nyear = 0;

int nmonth = 0;

int nweek = 0;

if (!string.isnullorempty(strdate))

else

brtrresultmodelbrtrresultmodel = new brtrresultmodel();

stringbuilder sb = new stringbuilder();

//新增日曆

int i = 1;

for (int nday = 1; nday <= 31; )

else

if (i % 7 == 0)

i = i + 1;

nday = nday + 1;}}

string strresult = sb.tostring();

int nlasttrlength = strresult.lastindexof("");

strresult = stringutils.substring(strresult,nlasttrlength);

效果如圖:

js生成當月日曆

var date new date 當前是哪一年 var year date getfullyear 當前是哪個月,注意這裡的月是從0開始計數的 var month date getmonth 當前月的第一天的日期 var firstday newdate year,month,1 第一天是星期幾 ...

簡短的生成當月簽到日曆

解決方法 1.參考 原大神的日曆簽到 emmmm,找不到了,不過基本是在www.jq22.com上找到。2.自製 效果圖 優點 大小隨父元素大小變化,樣式及內容可以隨意修改,簡單容易修改當然功能也就簡單的。缺點 功能單一,只是展示當月,以及簽到的日期 使用 var thearr 0,13,1 get...

php 日曆設定當月節假 PHP簡單日曆實現方法

執行效果截圖如下 具體 如下 created on 2016 7 20 simcalendar 2016 08 顯示8月份日曆 function simcalendar date 簡單日曆輸出,本函式需要cal days in month的支援 param date y m 要輸出的日期 echo ...