本文共 3434 字,大约阅读时间需要 11 分钟。
<script type="text/javascript">var year = new Date().getFullYear();var month = new Date().getMonth();var result = [];for(var i = 1; i <= 31; i++){ var weekday = new Date(year, month, i).getDay(); if(weekday == 0 || weekday == 6 ){ result.push(i); } } document.write((month + 1) + "月:" + result.join(","));</script>
拍卖网
剩余时间:<span id='Countdown456'></span> <br />
<script> var liftoffTime456 = new Date(2010,5-1,28,17,0,0); var serverdate = new Date(2010,5-1,26,16,43,56); var localdate = new Date(); var jtime = localdate-serverdate; liftoffTime456.setUTCSeconds(liftoffTime456.getUTCSeconds()+Math.round(jtime/1000)); $(function() { $('#Countdown456').countdown({alwaysExpire: true, until: liftoffTime456, format: 'DHMS', timezone: +8, onExpiry:function(){ liftOff('456')} }); }); </script>
题目在网页里倒计时显示当年剩下的天时分秒,格式:XX年还剩下X天X时X分X秒
C#(ASP.NET)公历转农历的简单方法
static string SolarToChineseLunisolarDate(DateTime solarDateTime)
{ System.Globalization.ChineseLunisolarCalendar cal = new System.Globalization.ChineseLunisolarCalendar(); int year = cal.GetYear(solarDateTime); int month = cal.GetMonth(solarDateTime); int day = cal.GetDayOfMonth(solarDateTime); int leapMonth = cal.GetLeapMonth(year); return string.Format("农历{0}{1}({2})年{3}{4}月{5}{6}" , "甲乙丙丁戊己庚辛壬癸"[(year - 4) % 10] , "子丑寅卯辰巳午未申酉戌亥"[(year - 4) % 12] , "鼠牛虎兔龙蛇马羊猴鸡狗猪"[(year - 4) % 12] , month == leapMonth ? "闰" : "" , "无正二三四五六七八九十冬腊"[leapMonth > 0 && leapMonth <= month ? month - 1 : month] , "初十廿三"[day / 10] , "日一二三四五六七八九"[day % 10] ); }
使用的方法非常简单:
string 农历 = SolarToChineseLunisolarDate(DateTime.Today);
本文转自曾祥展博客园博客,原文链接:http://www.cnblogs.com/zengxiangzhan/archive/2009/12/05/1617423.html,如需转载请自行联系原作者