net显示今天农历的代码!
农历时间日期代码

农历时间日期<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>单行带农历的日期时间代码</title></head><body><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, 5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */ new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ), /* 89 */ new tagLunarCal( 23, 4, 0, 59, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 42, 0, 1, 4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 31, 0, 2, 9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),new tagLunarCal( 21, 2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 93 */ new tagLunarCal( 39, 0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 28, 7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ),new tagLunarCal( 48, 0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),new tagLunarCal( 37, 0, 1, 35, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 97 */ new tagLunarCal( 25, 5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),new tagLunarCal( 44, 0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),new tagLunarCal( 33, 0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 22, 4, 6, 56, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ), /* 101 */ new tagLunarCal( 40, 0, 1, 2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 30, 9, 2, 7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 49, 0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 38, 0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ), /* 105 */ new tagLunarCal( 27, 6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),new tagLunarCal( 46, 0, 0, 28, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0 ),new tagLunarCal( 35, 0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),new tagLunarCal( 24, 4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ), /* 109 */new tagLunarCal( 42, 0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 31, 0, 5, 49, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 40, 0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 113 */new tagLunarCal( 28, 6, 2, 5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),new tagLunarCal( 47, 0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ),new tagLunarCal( 36, 0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),new tagLunarCal( 25, 5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ), /* 117 */new tagLunarCal( 43, 0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ),new tagLunarCal( 32, 0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ),new tagLunarCal( 22, 3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ) ];/* 民國年每月之日數all by */SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];/* 民國年每月之累積日數, 平年與閏年*/SolarDays = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397 ];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;elsed = 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;Age = kc % 60;if ( Age < 22 )Age = 22 - Age;elseAge = 82 - Age;if ( acc <= LunarCal[y].BaseDays ) {y--;LunarYear = SolarYear - 1;leap = GetLeap( LunarYear );sm += 12;acc = SolarDays[leap*14 + sm] + SolarDate;}elseLunarYear = 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.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); document.write("", today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日 ",d[today.getDay()+1],"");months = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];days = ["初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"];document.write( " 农历"+months[LunarMonth-1]+"月" + days[LunarDate-1] + "");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;elsereturn 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日) */}//--></SCRIPT><a target=_blank href=><FONT color=#2b68a7><SCRIPT>CalConv();</SCRIPT></FONT></a></body></html>本代码由<a href=>网页特效网</a>提供QQ菜单似的下拉门<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><title>下拉滚动门</title><style type="text/css">body{margin:10px;padding:10px;}body,td,div,span,li{font-size:12px;}.title01,.title02{color:#fff;font-weight:bold;}#DoorP{border:12px solid #eee; width:150px;height:300px;padding:4px; background:#fff;}.title01{width:100%;height:25px; background:#00ccff; cursor:pointer;}.title02{width:100%;height:25px; background:#99cc00; cursor:pointer;}.content{background:#eee;border-bottom:2px solid #fff; overflow:hidden;color:#666;padding-left:4px;padding-right:4px;line-height:18px;}</style><!--棕:#eee;蓝:#00ccff;绿:#99cc00;--></head><body><div id="DoorP"><table><tr><td>第一层信息</td></tr></table><div class="content">十三妖<br/>十三妖<br/>十三妖<br/></div><table><tr><td>第二层信息</td></tr></table><div class="content"> ThirdteenDevil</div><table><tr><td>第三层信息</td></tr></table><div class="content">devil13th</div></div><script type="text/javascript">var open = 2;// 设置初始打开的层序号var openState = new Array();var closeState = new Array();var dH = 220;function $(id){if(document.getElementById(id)) {return document.getElementById(id); }else{alert("没有找到!");}}function $tag(id,tagName){return $(id).getElementsByTagName(tagName)}function closeMe(Cid,Oid){var h = parseInt(Ds[Cid].style.height);//alert(h);if(h > 0){h = h - Math.ceil(h/3);Ds[Cid].style.height = h+"px";}else{openMe(Oid);clearTimeout(closeState[Cid]);return false;}closeState[Cid] = setTimeout("closeMe("+Cid+","+Oid+")"); }function openMe(Oid){var h = parseInt(Ds[Oid].style.height);//alert(h);if(h < dH){h = h + Math.ceil((dH-h)/3);Ds[Oid].style.height = h+"px";}else{clearTimeout(openState[Oid]);return false;}openState[Oid] = setTimeout("openMe("+Oid+")");}var Ds = $tag("DoorP","div");var Ts = $tag("DoorP","table");if(Ds.length != Ts.length){alert("标题和内容数目不相同!");}for(var i = 0 ; i < Ds.length ; i++){if(i==open){Ds[i].style.height = dH+"px";Ts[i].className="title01";}else{Ds[i].style.height = "0px";Ts[i].className="title02";}Ts[i].value = i;Ts[i].onclick = function(){if(open==this.value){return false;}Ts[open].className="title02";Ts[this.value].className="title01";for(var i = 0 ; i < openState.length ; i++){clearTimeout(openState[i]);clearTimeout(closeState[i]);}closeMe(open,this.value);//openMe(this.value);open = this.value;}}//直接打开层函数function showDiv(id){Ds[id].style.height=dH+"px";Ds[open].style.height="0px";open = id;}//渐渐打开层函数</script></body></html>本代码由<a href=>网页特效网</a>提供文字的折叠与展开<div align="center"><table border="0" width="300" cellpadding="0" style="border-collapse: collapse" id="table1" bgcolor="#F3F3F3" cellspacing="10"><tr><td valign="top" style="line-height: 150%"><div class="block" id="smallContent" style="display:block"><span style="font-size: 9pt"> <b>专辑介绍:</b>青春光影是由中国80后影像精英共同组建的新媒体影视摄制机构。
带农历的日期代码

ResultMonth = - CnMonth[0];}
else {ResultMonth = CnMonth[0];}
ResultDay = CnBeginDay + DaysCount;
var Dizhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
return Tiangan[YYYY%10]+Dizhi[YYYY%12];
}
function CnDateofDateStr(DateGL){
if(CnMonthofDate(DateGL)=="零月") return "请调整您的计算机日期!";
0x87,0x6a,0x57,0x04,0x12,0x75,0x2b,0x00,0x1d,0xb6,0x95,0x00,0x8a,0xad,0x55,0x02,
0x15,0x55,0xaa,0x00,0x82,0x55,0x6c,0x07,0x0d,0xc9,0x76,0x00,0x17,0x64,0xb7,0x00,
CnDaysCount+= CnMonthDays[I];
I++;
}
Java万年历源代码,可显示公历、农历、系统时间、国际时间

import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.table.DefaultTableModel;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import java.util.Locale;import java.util.TimeZone;public class wannianli extends JFrame implements ActionListener, MouseListener {private Calendar cld = Calendar.getInstance();//获取一个Calendar类的实例对象private String[] astr = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };private DefaultTableModel dtm = new DefaultTableModel(null, astr);private JTable table = new JTable(dtm);private JScrollPane sp = new JScrollPane(table);private JButton bLastYear = new JButton("上一年");private JButton bNextYear = new JButton("下一年");private JButton bLastMonth = new JButton("上月");private JButton bNextMonth = new JButton("下月");private JPanel p1 = new JPanel(); // 设立八个中间容器,装入布局控制日期的按钮模块private JPanel p2 = new JPanel(new GridLayout(3,2));//网格布局private JPanel p3 = new JPanel(new BorderLayout());//边界布局private JPanel p4 = new JPanel(new GridLayout(2,1));private JPanel p5 = new JPanel(new BorderLayout());private JPanel p6 = new JPanel(new GridLayout(2,2));private JPanel p7 = new JPanel(new GridLayout(2,1));private JPanel p8 = new JPanel(new BorderLayout());private JComboBox timeBox = newJComboBox(TimeZone.getAvailableIDs());//对所有支持时区进行迭代,获取所有的id;private JTextField jtfYear = new JTextField(5);// jtfYeaar年份显示输入框private JTextField jtfMonth = new JTextField(2);// jtfMouth月份显示输入框private JTextField timeField=new JTextField();//各城市时间显示框private static JTextArea jta = new JTextArea(10,5);//农历显示区private JScrollPane jsp = new JScrollPane(jta);private JLabel l = new JLabel("花江小精灵:亲!你可以直接输入年月查询.");private JLabel lt = new JLabel();private JLabel ld = new JLabel();private JLabel lu = new JLabel("农历和节气");private JLabel null1=new JLabel();private int lastTime;//private String localTime = null;private String s = null;private SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy年MM月dd 日 hh时mm分ss秒");public wannianli() {super("花江日历过去仅留追忆,未来刚生憧憬,唯有坚守本心,把握今天 ZYT 詹永堂 ");// 框架命名this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 窗口关闭函数this.getContentPane().setLayout(new BorderLayout(9, 10));jta.setLineWrap(true);// 长度大于分配长度时候则换行jta.setFont(new Font("黑体", Font.BOLD, 16));table.setBackground(Color.white);table.setGridColor(Color.pink);// 星期之间的网格线是灰色的table.setBackground(Color.white);table.setColumnSelectionAllowed(true);// 将table中的列设置为可选择的table.setSelectionBackground(Color.pink);// 当选定某一天时背景颜色为黑色table.setSelectionForeground(Color.GREEN);table.setBackground(new Color(184,207, 229));// 日期显示表格为浅蓝色table.setFont(new Font("黑体", Font.BOLD, 24));// 日期数字字体格式table.setRowHeight(26);// 表格的高度table.addMouseListener(this); // 鼠标监听器、lu.setFont(new Font("黑体", Font.BOLD, 22));//农历标签格氏jtfYear.addActionListener(this);// 可输入年份的文本框// 为各个按钮添加监听函数bLastYear.addActionListener(this);bNextYear.addActionListener(this);bLastMonth.addActionListener(this);bNextMonth.addActionListener(this);timeBox.addItemListener(new TimeSelectedChangedListener());// 将按钮添加到Jpane上p1.add(bLastYear);p1.add(jtfYear);// 年份输入文本框p1.add(bNextYear);p1.add(bLastMonth);p1.add(jtfMonth);p1.add(bNextMonth);p3.add(jsp, BorderLayout.SOUTH);p3.add(lu,BorderLayout.CENTER);p3.add(ld, BorderLayout.NORTH);p4.add(lt);p4.add(l);p5.add(p4, BorderLayout.SOUTH);p5.add(sp, BorderLayout.CENTER);p5.add(p1, BorderLayout.NORTH);p6.add(timeBox);p6.add(null1);p6.add(timeField);p8.add(p2,BorderLayout.CENTER);p8.add(p7,BorderLayout.SOUTH);this.getContentPane().add(p3, BorderLayout.EAST);this.getContentPane().add(p5, BorderLayout.CENTER);this.getContentPane().add(p6,BorderLayout.SOUTH);this.getContentPane().add(p8,BorderLayout.WEST);String[] strDate = DateFormat.getDateInstance().format(new Date()) .split("-");// 获取日期cld.set(Integer.parseInt(strDate[0]), Integer.parseInt(strDate[1]) - 1,0);showCalendar(Integer.parseInt(strDate[0]),Integer.parseInt(strDate[1]), cld);jtfMonth.setEditable(false);// 设置月份文本框为不可编辑jtfYear.setText(strDate[0]);jtfMonth.setText(strDate[1]);this.showTextArea(strDate[2]);ld.setFont(new Font("新宋体", Font.BOLD, 24));new Timer(lt).start();new TimeThread().start();this.setBounds(200, 200, 700, 350);this.setResizable(false);this.setVisible(true);}public void showCalendar(int localYear, int localMonth, Calendar cld) {int Days = getDaysOfMonth(localYear, localMonth) +cld.get(Calendar.DAY_OF_WEEK) -2;Object [] ai = new Object[7];lastTime = 0;for (int i = cld.get(Calendar.DAY_OF_WEEK)-1; i <= Days; i++) {ai[i%7] =String.valueOf(i-(cld.get(Calendar.DAY_OF_WEEK)-2));if (i%7 == 6){dtm.addRow(ai);ai = new Object[7];lastTime++;}}dtm.addRow(ai);}public int getDaysOfMonth(int Year, int Month) {//计算各月的天数if(Month==1||Month==3||Month==5||Month==7||Month==8||Month==10||Mont h==12){return 31;}if(Month==4||Month==6||Month==9||Month==11){return 30;}if(Year%4==0&&Year%100!=0||Year%400==0)//闰年{return 29;}else {return 28;}}public void actionPerformed(ActionEvent e)//从界面上获取年月数据{if(e.getSource() == jtfYear || e.getSource() == bLastYear || e.getSource() == bNextYear ||e.getSource() == bLastMonth || e.getSource() == bNextMonth){int m, y;try//控制输入的年份正确,异常控制{if (jtfYear.getText().length() != 4){throw new NumberFormatException();}y = Integer.parseInt(jtfYear.getText());m = Integer.parseInt(jtfMonth.getText());}catch (NumberFormatException ex){JOptionPane.showMessageDialog(this, "请输入4位0-9的数字!", "年份有误", JOptionPane.ERROR_MESSAGE);return;}ld.setText("没有选择日期");for (int i = 0; i < lastTime+1; i++){ dtm.removeRow(0);}if(e.getSource() ==bLastYear){ jtfYear.setText(String.valueOf(--y)); }if(e.getSource() ==bNextYear){jtfYear.setText(String.valueOf(++y)); }if(e.getSource() == bLastMonth){if(m == 1){jtfYear.setText(String.valueOf(--y));m = 12;jtfMonth.setText(String.valueOf(m));}else{jtfMonth.setText(String.valueOf(--m));}}if(e.getSource() == bNextMonth){if(m == 12){jtfYear.setText(String.valueOf(++y));m = 1;jtfMonth.setText(String.valueOf(m));}else{jtfMonth.setText(String.valueOf(++m));}}cld.set(y, m-1, 0);showCalendar(y, m, cld);}}public void mouseClicked(MouseEvent e){jta.setText(null);int r = table.getSelectedRow();int c = table.getSelectedColumn();if (table.getValueAt(r,c) == null){ld.setText("没有选择日期");}else{this.showTextArea(table.getValueAt(r,c));}}private void showTextArea(Object selected){ld.setText(jtfYear.getText()+"年"+jtfMonth.getText()+"月"+selected+"日");}public static void main(String[] args){JFrame.setDefaultLookAndFeelDecorated(true);JDialog.setDefaultLookAndFeelDecorated(true);new wannianli();jta.setText(today());}private void updateTimeText(String timeZoneId) {if(timeZoneId != null){TimeZone timeZone = TimeZone.getTimeZone(timeZoneId);dateFormat.setTimeZone(timeZone);Calendar calendar = Calendar.getInstance();calendar.setTimeZone(timeZone);timeField.setText(dateFormat.format(calendar.getTime()));}else{timeField.setText(null);}}private class TimeSelectedChangedListener implements ItemListener { public void itemStateChanged(ItemEvent e) {if (e.getStateChange()==ItemEvent.SELECTED) {if (e.getItem() instanceof String) {s = e.getItem().toString();}}}}private class TimeThread extends Thread{public void run(){while(true){updateTimeText(s);try{Thread.sleep(100);}catch(InterruptedException e){e.printStackTrace();}}}}class Timer extends Thread //显示系统时间{private JLabel lt;private SimpleDateFormat fy = new SimpleDateFormat(" Gyyyy.MM.dd HH:mm:ss ");public Timer(JLabel lt){this.lt=lt;}public void run(){while(true){try{lt.setText(fy.format(new Date()));this.sleep(500);}catch(InterruptedException ex){ex.printStackTrace();}}}}final private static long[] lunarInfo= new long[] { 0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554,0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0,0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566,0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550,0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0,0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263,0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0,0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5,0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0,0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9,0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0,0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520,0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0 };final private static int[] year20 = new int[] { 1, 4, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };final private static int[] year19 = new int[] { 0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 };final private static int[] year2000 = new int[] { 0, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };public final static String[] nStr1 = new String[] { "", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一","十二" };private final static String[] Gan = new String[] { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };private final static String[] Zhi = new String[] { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };private final static String[] Animals = new String[] { "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" };// 传回农历 y年的总天数final private static int lYearDays(int y) {int i, sum = 348;for (i = 0x8000; i > 0x8; i >>= 1) {if ((lunarInfo[y - 1900] & i) != 0)sum += 1;}return (sum + leapDays(y));}// 传回农历 y年闰月的天数final private static int leapDays(int y) {if (leapMonth(y) != 0) {if ((lunarInfo[y - 1900] & 0x10000) != 0)return 30;elsereturn 29;} elsereturn 0;}// 传回农历 y年闰哪个月 1-12 , 没闰传回 0final private static int leapMonth(int y) {return (int) (lunarInfo[y - 1900] & 0xf);}//传回农历 y年m月的总天数final private static int monthDays(int y, int m) {if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)return 29;elsereturn 30;}// 传回农历 y年的生肖final public static String AnimalsYear(int y) {return Animals[(y - 4) % 12];}//传入月日的offset 传回干支,0=甲子final private static String cyclicalm(int num) {return (Gan[num % 10] + Zhi[num % 12]);}// 传入 offset 传回干支, 0=甲子final public static String cyclical(int y) {int num = y - 1900 + 36;return (cyclicalm(num));}// 传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6final private long[] Lunar(int y, int m) {long[] nongDate = new long[7];int i = 0, temp = 0, leap = 0;Date baseDate = new GregorianCalendar(1900 + 1900, 1,31).getTime();Date objDate = new GregorianCalendar(y + 1900, m, 1).getTime();long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;if (y < 2000)offset += year19[m - 1];if (y > 2000)offset += year20[m - 1];if (y == 2000)offset += year2000[m - 1];nongDate[5] = offset + 40;nongDate[4] = 14;for (i = 1900; i < 2050 && offset > 0; i++) {temp = lYearDays(i);offset -= temp;nongDate[4] += 12;}if (offset < 0) {offset += temp;i--;nongDate[4] -= 12;}nongDate[0] = i;nongDate[3] = i - 1864;leap = leapMonth(i); // 闰哪个月nongDate[6] = 0;for (i = 1; i < 13 && offset > 0; i++) {// 闰月if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { --i;nongDate[6] = 1;temp = leapDays((int) nongDate[0]);} else {temp = monthDays((int) nongDate[0], i);}// 解除闰月if (nongDate[6] == 1 && i == (leap + 1))nongDate[6] = 0;offset -= temp;if (nongDate[6] == 0)nongDate[4]++;}if (offset == 0 && leap > 0 && i == leap + 1) {if (nongDate[6] == 1) {nongDate[6] = 0;} else {nongDate[6] = 1;--i;--nongDate[4];}}if (offset < 0) {offset += temp;--i;--nongDate[4];}nongDate[1] = i;nongDate[2] = offset + 1;return nongDate;}// 传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6final public static long[] calElement(int y, int m, int d) {long[] nongDate = new long[7];int i = 0, temp = 0, leap = 0;Date baseDate = new GregorianCalendar(0 + 1900, 0, 31).getTime();Date objDate = new GregorianCalendar(y, m - 1, d).getTime();long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;nongDate[5] = offset + 40;nongDate[4] = 14;for (i = 1900; i < 2050 && offset > 0; i++) {temp = lYearDays(i);offset -= temp;nongDate[4] += 12;}if (offset < 0) {offset += temp;i--;nongDate[4] -= 12;}nongDate[0] = i;nongDate[3] = i - 1864;leap = leapMonth(i); // 闰哪个月nongDate[6] = 0;for (i = 1; i < 13 && offset > 0; i++) {// 闰月if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { --i;nongDate[6] = 1;temp = leapDays((int) nongDate[0]);} else {temp = monthDays((int) nongDate[0], i);}// 解除闰月if (nongDate[6] == 1 && i == (leap + 1))nongDate[6] = 0;offset -= temp;if (nongDate[6] == 0)nongDate[4]++;}if (offset == 0 && leap > 0 && i == leap + 1) { if (nongDate[6] == 1) {nongDate[6] = 0;} else {nongDate[6] = 1;--i;--nongDate[4];}}if (offset < 0) {offset += temp;--i;--nongDate[4];}nongDate[1] = i;nongDate[2] = offset + 1;return nongDate;}public final static String getChinaDate(int day) { String a = "";if (day == 10)return"初十";if (day == 20)return"二十";if (day == 30)return"三十";int two = (int) ((day) / 10);if (two == 0)a = "初";if (two == 1)a = "十";if (two == 2)a = "廿";if (two == 3)a = "三";int one = (int) (day % 10);switch (one) {case 1:a += "一";break;case 2:a += "二";break;case 3:a += "三";break;case 4:a += "四";break;case 5:a += "五";break;case 6:a += "六";break;case 7:a += "七";break;case 8:a += "八";break;case 9:a += "九";break;}return a;}public static String today() {Calendar today = Calendar.getInstance(Locale.SIMPLIFIED_CHINESE);int year = today.get(Calendar.YEAR);int month = today.get(Calendar.MONTH) + 1;int date = today.get(Calendar.DATE);long[] l = calElement(year, month, date);StringBuffer sToday = new StringBuffer();try {sToday.append(sdf.format(today.getTime()));sToday.append(" \n");sToday.append(" \n");sToday.append(" \n");sToday.append(" 农历");sToday.append(cyclical(year));sToday.append('(');sToday.append(AnimalsYear(year));sToday.append(")年");sToday.append(" \n");sToday.append(" ");sToday.append(nStr1[(int) l[1]]);sToday.append("月");sToday.append(getChinaDate((int) (l[2])));return sToday.toString();} finally {sToday = null;}}private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy 年M月d日 EEEEE");public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) { }}。
农历时间日期代码

农历时间日期<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>单行带农历的日期时间代码</title></head><body><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, 5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */ new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ), /* 89 */ new tagLunarCal( 23, 4, 0, 59, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 42, 0, 1, 4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 31, 0, 2, 9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),new tagLunarCal( 21, 2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 93 */ new tagLunarCal( 39, 0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 28, 7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ),new tagLunarCal( 48, 0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),new tagLunarCal( 37, 0, 1, 35, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 97 */ new tagLunarCal( 25, 5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),new tagLunarCal( 44, 0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),new tagLunarCal( 33, 0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 22, 4, 6, 56, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ), /* 101 */ new tagLunarCal( 40, 0, 1, 2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 30, 9, 2, 7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 49, 0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 38, 0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ), /* 105 */ new tagLunarCal( 27, 6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),new tagLunarCal( 46, 0, 0, 28, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0 ),new tagLunarCal( 35, 0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),new tagLunarCal( 24, 4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ), /* 109 */new tagLunarCal( 42, 0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 31, 0, 5, 49, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 40, 0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 113 */new tagLunarCal( 28, 6, 2, 5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),new tagLunarCal( 47, 0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ),new tagLunarCal( 36, 0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),new tagLunarCal( 25, 5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ), /* 117 */new tagLunarCal( 43, 0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ),new tagLunarCal( 32, 0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ),new tagLunarCal( 22, 3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ) ];/* 民國年每月之日數all by */SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];/* 民國年每月之累積日數, 平年與閏年*/SolarDays = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397 ];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;elsed = 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;Age = kc % 60;if ( Age < 22 )Age = 22 - Age;elseAge = 82 - Age;if ( acc <= LunarCal[y].BaseDays ) {y--;LunarYear = SolarYear - 1;leap = GetLeap( LunarYear );sm += 12;acc = SolarDays[leap*14 + sm] + SolarDate;}elseLunarYear = 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.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); document.write("", today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日 ",d[today.getDay()+1],"");months = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];days = ["初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"];document.write( " 农历"+months[LunarMonth-1]+"月" + days[LunarDate-1] + "");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;elsereturn 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日) */}//--></SCRIPT><a target=_blank href=><FONT color=#2b68a7><SCRIPT>CalConv();</SCRIPT></FONT></a></body></html>本代码由<a href=>网页特效网</a>提供QQ菜单似的下拉门<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><title>下拉滚动门</title><style type="text/css">body{margin:10px;padding:10px;}body,td,div,span,li{font-size:12px;}.title01,.title02{color:#fff;font-weight:bold;}#DoorP{border:12px solid #eee; width:150px;height:300px;padding:4px; background:#fff;}.title01{width:100%;height:25px; background:#00ccff; cursor:pointer;}.title02{width:100%;height:25px; background:#99cc00; cursor:pointer;}.content{background:#eee;border-bottom:2px solid #fff; overflow:hidden;color:#666;padding-left:4px;padding-right:4px;line-height:18px;}</style><!--棕:#eee;蓝:#00ccff;绿:#99cc00;--></head><body><div id="DoorP"><table><tr><td>第一层信息</td></tr></table><div class="content">十三妖<br/>十三妖<br/>十三妖<br/></div><table><tr><td>第二层信息</td></tr></table><div class="content"> ThirdteenDevil</div><table><tr><td>第三层信息</td></tr></table><div class="content">devil13th</div></div><script type="text/javascript">var open = 2;// 设置初始打开的层序号var openState = new Array();var closeState = new Array();var dH = 220;function $(id){if(document.getElementById(id)) {return document.getElementById(id); }else{alert("没有找到!");}}function $tag(id,tagName){return $(id).getElementsByTagName(tagName)}function closeMe(Cid,Oid){var h = parseInt(Ds[Cid].style.height);//alert(h);if(h > 0){h = h - Math.ceil(h/3);Ds[Cid].style.height = h+"px";}else{openMe(Oid);clearTimeout(closeState[Cid]);return false;}closeState[Cid] = setTimeout("closeMe("+Cid+","+Oid+")"); }function openMe(Oid){var h = parseInt(Ds[Oid].style.height);//alert(h);if(h < dH){h = h + Math.ceil((dH-h)/3);Ds[Oid].style.height = h+"px";}else{clearTimeout(openState[Oid]);return false;}openState[Oid] = setTimeout("openMe("+Oid+")");}var Ds = $tag("DoorP","div");var Ts = $tag("DoorP","table");if(Ds.length != Ts.length){alert("标题和内容数目不相同!");}for(var i = 0 ; i < Ds.length ; i++){if(i==open){Ds[i].style.height = dH+"px";Ts[i].className="title01";}else{Ds[i].style.height = "0px";Ts[i].className="title02";}Ts[i].value = i;Ts[i].onclick = function(){if(open==this.value){return false;}Ts[open].className="title02";Ts[this.value].className="title01";for(var i = 0 ; i < openState.length ; i++){clearTimeout(openState[i]);clearTimeout(closeState[i]);}closeMe(open,this.value);//openMe(this.value);open = this.value;}}//直接打开层函数function showDiv(id){Ds[id].style.height=dH+"px";Ds[open].style.height="0px";open = id;}//渐渐打开层函数</script></body></html>本代码由<a href=>网页特效网</a>提供文字的折叠与展开<div align="center"><table border="0" width="300" cellpadding="0" style="border-collapse: collapse" id="table1" bgcolor="#F3F3F3" cellspacing="10"><tr><td valign="top" style="line-height: 150%"><div class="block" id="smallContent" style="display:block"><span style="font-size: 9pt"> <b>专辑介绍:</b>青春光影是由中国80后影像精英共同组建的新媒体影视摄制机构。
老黄历吉日吉时查询接口实现及代码示例

老黄历吉日吉时查询接口实现及代码示例环境搭建什么的就不写了,因为网上的教程是很多的,随便搜一下即可。
下面直接从第一个app应用开始详细记录我的android学习之旅1.建立第一个app在eclipse中,File--->New--->Android Application Project新建一个android应用项目。
Application Name是要显示给其他人看的应用名称,Project Name是自己开发能看到的项目名称,package name就和java中差不多。
Minimum Required SDK 是能支持的最低版本的安卓SDK,越低越好。
Target SDK 翻译过来就是目标SDK,当然是越高越好Compile With 就和Target SDK的版本一样就行,然后一路Next 即可。
到此为止,这个Adnroid 项目已经是一个基本的Hello World程序了。
2.执行android程序这一节学习的是如何在android模拟器上安装并且运行自己的应用。
运行之前,先要认识项目里的几个文件和目录:AndroidManifest.xml描述了应用程序的基本特性并且定义了每一个组件。
其中有一个<uses-sdk>,使用android:minSdkVersion和android:targetSdkVersion两个属性来声明你的应用对不同Android 版本的兼容性。
<uses-sdk    android:minSdkVersion=    android:targetSdkVersion= />src/是存放主要源代码的文件夹,默认情况下,里面会包括一个Activity类,这个类会在点击应用程序图标启动的时候运行res/包含一些存放资源文件的目录例如:drawable-hdpi/             存放适用于HDPI屏幕的图片素材,同理其他文件夹存放适用于其他屏幕的图片素材layout/                存放用户定义界面的文件values/                存放其他xml 文件,也是资源的集合,例如字符串和颜色的定义右击项目,点击run Adnroid application ,运行第一个android 程序,这是一个很开心的尝试,android的一小步,自己的一大步。
.NET4.0 日历控件

FirstDayOfWeek="{Default,Monday,Tuesday,Wednesday,Thursday,
Friday,Saturday,Sunday}"
NextMonthText="…"
ShowNextPrevMonth="True" NextMonthText="[Next]"
SelectedDayStyle-BackColor="#DBDBDB"
OnSelectionChanged="calA_SC"/>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
4.0
Calendar日历控件用于在浏览器中显示日历,该控件可显示某个月的日历并允许用户选择日期,也可以跳到前一个或下一个月。Calendar日历控件的声明语法如下所示,基本属性如表6-15所示。
<ASP:Calendar Runat="Server" Id="…"
Cellpadding="n"
用于选择一周或整个月的链接的列的样式。
下面是一个简单使用日历控件的实例,代码如下所示。
文件名:Calendar.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Calendar.aspx.cs" Inherits="Calendar" %>
python生日提醒_Python实现农历生日提醒功能

python生日提醒_Python实现农历生日提醒功能农历生日提醒是一种非常实用的功能,能够帮助我们记住家人和朋友的农历生日,并在特定日期提醒我们发送祝福或者准备礼物。
在这篇文章中,我将使用Python来实现农历生日提醒功能。
``````安装完成后,我们可以开始编写代码了。
首先,我们需要引入需要的库:```pythonimport tkinter as tkfrom lunarcalendar import Converter, Solar```接下来,我们需要定义一个函数来获取当前的农历日期:```pythondef get_lunar_date(:solar = Solar(today.year, today.month, today.day)lunar = Converter(.solar_to_lunar(solar)return lunar```接下来,我们需要定义一个函数来检查是否有农历生日需要提醒,并在有生日需要提醒时弹出一个消息框:```pythondef check_birthday(:lunar_date = get_lunar_datelunar_month = lunar_date.monthlunar_day = lunar_date.dayif (lunar_month, lunar_day) in birthday_dict:name = birthday_dict[(lunar_month, lunar_day)]message = f"今天是{name}的农历生日!"tk.messagebox.showinfo("生日提醒", message)```在该函数中,我们首先获取当前的农历日期。
然后,我们使用获取的农历日期作为键来查找生日字典birthday_dict中是否有对应的生日。
接下来,我们需要定义一个函数来添加生日信息到生日字典:```pythondef add_birthday(:name = name_entry.getdate = date_entry.getlunar_date = Converter(.solar_to_lunar(Solar(lunar_date.year, lunar_date.month, lunar_date.day))birthday_dict[(lunar_date.month, lunar_date.day)] = namename_entry.delete(0, tk.END)date_entry.delete(0, tk.END)```在该函数中,我们首先从输入框中获取生日人的姓名和农历日期。
.NET4.0 简单的日历控件

4.0 简单的日历控件在网页中,用户可以在页头部位插入一个日历控件,方便访问者随时了解当前日期信息。
并且有些网页中,除了插入日历内容外,还包含有天气信息等等。
(1)在窗口中,执行【文件】|【新建】|【项目】命令。
在弹出的【新建项目】对话框中,选择Web模板,并在中间栏中选择【 空Web应用程序】选项。
然后,再修改【名称】为show_date,单击【确定】按钮,如图8-25所示。
图8-25 创建项目(2)在【解决方案资源管理器】中,右击站点目录,并执行【添加新项】命令。
在弹出的【添加新项】对话框中,选择【Visual C#】模板,并选择【Web窗体】选项,单击【添加】按钮,如图8-26所示。
图8-26 添加窗体页(3)再在【解决方案资源管理器】中,右击站点目录,并执行【添加新项】命令。
在弹出的【添加新项】对话框中,选择【Visual C#】模板,并选择【Web用户控件】选项。
然后,将【名称】修改为date,并单击【添加】按钮,如图8-27所示。
图8-27 添加用户控件(4)展开date.ascx文件,并双击date.ascx.cs文件,在编辑器中编写获取日期、农历日期、星期等信息。
详细代码如下:(5)再双击date.ascx文件,并在编辑器中,编写如下代码。
该文件用于显示日历内容。
而由于用户不能直接访问该文件,所以必须通过加载到窗体页中查看效果。
(6)双击Default.aspx文件,并在该文件中,加载所设计的用户按钮,来查看(7)单击【启动调试】按钮,即可浏览窗体页中所加载的控件效果,如图8-28所示。
用户还可以在该控件中,添加时间、天气信息等内容。
这样,这个控件就可以直接应该到不同网页中。
图8-28 显示控件。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
net显示今天农历的代码!
[csharp]using System;
using System.Globalization;//
namespace Project.ChinaDate
{
///
<summary>
/// 显示今天农历类
///
</summary>
public
class CNDate
{
private DateTime m_Date; //今天的日期
private
readonly
int cny; //农历的年月日
private
int cnm; //农历的年月日
private
readonly
int cnd; //农历的年月日
private
readonly
int icnm; //农历闰月
///
<summary>
/// 显示日期构造函数
///
</summary>
public CNDate()
{
m_Date = DateTime.Today;
ChineseLunisolarCalendar cnCalendar =
new ChineseLunisolarCalendar();
cny = cnCalendar.GetSexagenaryYear(m_Date);
cnm = cnCalendar.GetMonth(m_Date);
cnd = cnCalendar.GetDayOfMonth(m_Date);
icnm =
cnCalendar.GetLeapMonth(cnCalendar.GetYear(m_Date));
}
///
<summary>
/// 返回格式化的公历显示
///
</summary>
///
<returns>格式如:2008年05月14日</returns>
public
string GetDate()
{
int y = m_Date.Year;
int m = m_Date.Month;
int d = m_Date.Day;
return String.Format("{0}年{1:00}月{2:00}日", y, m, d); }
///
<summary>
/// 返回格式化的星期显示
///
</summary>
///
<returns>格式如:星期日</returns>
public
string GetWeek()
{
string ws =
"星期";
int w = Convert.ToInt32(m_Date.DayOfWeek);
ws = ws +
"日一二三四五六".Substring(w, 1);
return ws;
}
///
<summary>
/// 返回格式化的农历显示
///
</summary>
///
<returns>格式如:戊子(鼠)年润四月廿三</returns>
public
string GetCNDate()
{
string txcns =
"";
const
string szText1 =
"癸甲乙丙丁戊己庚辛壬";
const
string szText2 =
"亥子丑寅卯辰巳午未申酉戌";
const
string szText3 =
"猪鼠牛虎免龙蛇马羊猴鸡狗";
int tn = cny %
10; //天干
int dn = cny %
12; //地支
txcns += szText1.Substring(tn, 1);
txcns += szText2.Substring(dn, 1);
txcns +=
"("
+ szText3.Substring(dn, 1) +
")年";
//格式化月份显示
string[] cnMonth ={ "", "正月", "二月", "三月", "四月", "五月", "六月" , "七月", "八月", "九月", "十月", "十一月", "十二月", "十二月" };
if (icnm >
0)
{
for (int i = icnm +
1; i <
13; i++) cnMonth = cnMonth[i -
1];
cnMonth[icnm] =
"闰"
+ cnMonth[icnm];
}
txcns += cnMonth[cnm];
string[] cnDay ={ "", "初一", "初二", "初三", "初四", "初五", "初六", "初七"
, "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", "十六"
, "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五"
, "廿六", "廿七", "廿八", "廿九", "三十" };
txcns += cnDay[cnd];
return txcns;
}
}[/csharp]。