惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
K
Kaspersky official blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Security Latest
Security Latest
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Simon Willison's Weblog
Simon Willison's Weblog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
O
OpenAI News
Help Net Security
Help Net Security
N
News and Events Feed by Topic
博客园 - 司徒正美
U
Unit 42
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
D
DataBreaches.Net
Y
Y Combinator Blog
AI
AI
L
LINUX DO - 最新话题
C
CXSECURITY Database RSS Feed - CXSecurity.com
H
Heimdal Security Blog
宝玉的分享
宝玉的分享
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
TaoSecurity Blog
TaoSecurity Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Project Zero
Project Zero
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
V
V2EX
博客园 - 【当耐特】
S
SegmentFault 最新的问题
小众软件
小众软件
L
LangChain Blog
N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
T
Tor Project blog
AWS News Blog
AWS News Blog
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
S
Securelist
T
Troy Hunt's Blog

博客园 - 小肠与小豆子

博客园MetaWeblog使用帮助 [ASP.NET 1.1]Global.asax.cs中的方法的含义 Microsoft .NET Pet Shop 4 架构与技术分析 转载:键盘模拟鼠标(实现用键盘操作鼠标光标)(示例代码下载) 转载:Ajax 实现在WebForm中拖动控件并即时在服务端保存状态数据 (Asp.net 2.0)(示例代码下载) 转载:Asp.net 2.0 用C# 创建 PDF文件[引用] (示例代码下载) 转载:Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载) 转载:ASP.NET 2.0 HttpHandler实现对某种文件类型权限保护 转载:ASP.net 2.0资料吐血收藏 解决:此页正在访问其它域的数据…… sql server系统表详细说明 数据库设计方法、规范与技巧 (转自Blogcn的我的窝) 14个数据库的设计技巧 (来自Blogcn中我的窝) SQL 数据库中所有的用户表,一个表的中的所有列信息 的SQL 转载:汉字转拼音_gb2312 C# C#中的一些常用属性 IIS状态一览表 IIS简介 IIS中的 MIME类型
转载:asp.net千奇百怪的日历
小肠与小豆子 · 2007-05-24 · via 博客园 - 小肠与小豆子

原文:http://blog.csdn.net/21aspnet/archive/2007/05/14/1607712.aspx

日历控件是我们经常使用的,本文把常用的几款日历总结如下。

 

<script language="JavaScript">
<!--
function CalConv()
 
{
 FIRSTYEAR 
= 1998;
 LASTYEAR 
= 2031;
 today 
= new Date();
 SolarYear 
= today.getFullYear();
 SolarMonth 
= today.getMonth() + 1;
 SolarDate 
= today.getDate();
 Weekday 
= today.getDay();
 LunarCal 
= [
  
new tagLunarCal( 27,  53431001001101101 ),
  
new tagLunarCal( 46,  04481001001011101 ), /* 88 */
  
new tagLunarCal( 35,  05531100100101101 ), /* 89 */
  
new tagLunarCal( 23,  40591101010010101 ),
  
new tagLunarCal( 42,  01,  41101010010101 ),
  
new tagLunarCal( 31,  02,  91101101001010 ),
  
new tagLunarCal( 21,  23140101101010101 ), /* 93 */
  
new tagLunarCal( 39,  05200101011010101 ),
  
new tagLunarCal( 28,  76251010101011011 ),
  
new tagLunarCal( 48,  00300010010111011 ),
  
new tagLunarCal( 37,  01351001001011011 ), /* 97 */
  
new tagLunarCal( 25,  53411100100101011 ),
  
new tagLunarCal( 44,  04461010100101011 ),
  
new tagLunarCal( 33,  05511011010010101 ),
  
new tagLunarCal( 22,  46561011010101010 ), /* 101 */
  
new tagLunarCal( 40,  01,  21011010101010 ),
  
new tagLunarCal( 30,  92,  70101010110101 ),
  
new tagLunarCal( 49,  03120100101110101 ),
  
new tagLunarCal( 38,  04171010010110110 ), /* 105 */
  
new tagLunarCal( 27,  66230101001010111 ),
  
new tagLunarCal( 46,  00280101001010110 ),
  
new tagLunarCal( 35,  01330110100100110 ),
  
new tagLunarCal( 24,  42380111010010101 ), /* 109 */
  
new tagLunarCal( 42,  04440110101010101 ),
  
new tagLunarCal( 31,  05491010110101010 ),
  
new tagLunarCal( 21,  26540101010110101 ),
  
new tagLunarCal( 40,  00590100101101101 ), /* 113 */
  
new tagLunarCal( 28,  62,  51010010101110 ),
  
new tagLunarCal( 47,  03101010010011101 ),
  
new tagLunarCal( 36,  04151101001001101 ),
  
new tagLunarCal( 25,  55201110100100110 ), /* 117 */
  
new tagLunarCal( 43,  00261101010100101 ),
  
new tagLunarCal( 32,  01311101101010100 ),
  
new tagLunarCal( 22,  32360110101101010 ) ];
 
/* 民国年每月之日数 */
 SolarCal 
= [ 312831303130313130313031 ];
 
/* 民国年每月之累积日数, 平年与闰年 */ 
SolarDays 
= [  0315990120151181212243273304334365396,  0316091121152182213244274305335366397 ];
 AnimalIdx 
= ["""""""""""""""""""""""" ];
 LocationIdx 
= [ """""""西" ];
 
if ( SolarYear <= FIRSTYEAR || SolarYear > LASTYEAR ) return 1;
 sm 
= SolarMonth - 1;
  
if ( sm < 0 || sm > 11 ) return 2;
  leap 
= GetLeap( SolarYear );
 
if ( sm == 1 )
  d 
= leap + 28;
 
else
  d 
= SolarCal[sm];
 
if ( SolarDate < 1 || SolarDate > d ) return 3;
 y 
= SolarYear - FIRSTYEAR;
 acc 
= SolarDays[ leap*14 + sm ] + SolarDate;
 kc 
= acc + LunarCal[y].BaseKanChih;
 Kan 
= kc % 10;
 Chih 
= kc % 12;
 Location 
= LocationIdx[kc % 4];
 Age 
= kc % 60;
 
if ( Age < 22 )
  Age 
= 22 - Age;
 
else
  Age 
= 82 - Age;
 Animal 
= AnimalIdx[ Chih ];
 
if ( acc <= LunarCal[y].BaseDays ) {
  y
--;
  LunarYear 
= SolarYear - 1;
  leap 
= GetLeap( LunarYear );
  sm 
+= 12;
  acc 
= SolarDays[leap*14 + sm] + SolarDate;
  }

 
else
  LunarYear 
= SolarYear;
   l1 
= LunarCal[y].BaseDays;
 
for ( i=0; i<13; i++ ) {
  l2 
= l1 + LunarCal[y].MonthDays[i] + 29;
  
if ( acc <= l2 ) break;
  l1 
= l2;
  }

 LunarMonth 
= i + 1;
 LunarDate 
= acc - l1;
 im 
= LunarCal[y].Intercalation;
 
if ( im != 0 && LunarMonth > im ) {
  LunarMonth
--;
  
if ( LunarMonth == im ) LunarMonth = -im;
  }

 
if ( LunarMonth > 12 ) LunarMonth -= 12;
 today
=new Date();
        
function initArray(){
                         
this.length=initArray.arguments.length
                         
for(var i=0;i<this.length;i++)
                         
this[i+1]=initArray.arguments[i]  }

       
var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
             document.write(
"<span class="jsdhtml"> ", today.getYear()," 年 ",today.getMonth()+1," 月 ",today.getDate()," 日 ",d[today.getDay()+1],"");
   document.write( 
"<span class="jsdhtml">【<u> 农历 " + LunarMonth + "" + LunarDate + "日</u>】" );
                                        
return 0
}

 
/* 求此民国年是否为闰年, 返回 0 为平年, 1 为闰年 */
function GetLeap( year )
 
{
   
if ( year % 400 == 0 )
     
return 1;
   
else if ( year % 100 == 0 )
     
return 0;
   
else if ( year % 4 == 0 )
     
return 1;
   
else
     
return 0;
 }

function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {
 
this.BaseDays = d;         /* 到民国 1 月 1 日到农历正月初一的累积日数 */
 
this.Intercalation = i;    /* 闰月月份. 0==此年没有闰月 */
 
this.BaseWeekday = w;      /* 此年民国 1 月 1 日为星期几再减 1 */
 
this.BaseKanChih = k;      /* 此年民国 1 月 1 日之干支序号减 1 */
 
this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此农历年每月之大小, 0==小月(29日), 1==大月(30日) */
}

//-->
CalConv();
</script>