《拓文asp.net网站内容管理系统》官方演示站。
 设为首页  
 收藏本站
 作者:黄振安
 QQ:53854651
首 页 开源拓文.NET编程网站编程网页设计图形图像数据库软件工程留言本
    站内搜索:  
您现在的位置: 拓文网络 → .NET编程 → ASP.NET → 阴历阳历转换[正文]

热 门 文 章

相 关 文 章
  • ASP.NET性能优化
  • 在.NET框架应用程序中发送电子邮件
  • .net打包自动安装数据库
  • asp.net开发wap必备:更好的匹配手机设备
  • 用ashx动态生成文件
  • windows 2003下asp.Net站点无法使用用户名+密码的方
  • ASP.NET中17种正则表达式
  • 提高ASP.Net应用程序性能的十大方法
  • 一个通过web.Mail发送邮件的类
  • 在DataGrid里面根据日期的不同显示new图标
  • 阴历阳历转换
     
    [作者:不详    转贴自:不详    点击数:    更新时间:2006-4-6 16:00:43]


                private DateTime m_Date;
                public DateTime Date
                {
                    get{ return m_Date;}
                    set{ m_Date = value;}
                }
      
                public CNDate()
                {
                    Date = DateTime.Today;
                }
                public CNDate(DateTime dt)
                {
                    Date = dt.Date;
                }
                //计算指定日期的星座序号
                public int GetConstellation()
                {
                    int Y, M, D;
                    Y = m_Date.Year;
                    M = m_Date.Month;
                    D = m_Date.Day;
                    Y = M * 100 + D;
                    if (((Y >= 321) && (Y <= 419))) { return 0;}
                    else if ((Y >= 420) && (Y <= 520)) { return 1;}
                    else if ((Y >= 521) && (Y <= 620)) { return 2;}
                    else if ((Y >= 621) && (Y <= 722)) { return 3;}
                    else if ((Y >= 723) && (Y <= 822)) { return 4;}
                    else if ((Y >= 823) && (Y <= 922)) { return 5;}
                    else if ((Y >= 923) && (Y <= 1022)) { return 6;}
                    else if ((Y >= 1023) && (Y <= 1121)) { return 7;}
                    else if ((Y >= 1122) && (Y <= 1221)) { return 8;}
                    else if ((Y >= 1222) || (Y <= 119)) { return 9;}
                    else if ((Y >= 120) && (Y <= 218)) { return 10;}
                    else if ((Y >= 219) && (Y <= 320)) { return 11;}
                    else { return -1;};
                }
      
                //计算指定日期的星座名称
                public string GetConstellationName()
                {
                    int Constellation;
                    Constellation = GetConstellation();
                    if ((Constellation >= 0) && (Constellation <= 11))
                    { return ConstellationName[Constellation];}
                    else
                    { return "";};
                }
      
                //计算公历当天对应的节气 0-23,-1表示不是节气
                public int l_GetLunarHolDay()
                {
                    byte Flag;
                    int Day, iYear, iMonth, iDay;
                    iYear = m_Date.Year;
                    if ((iYear < START_YEAR) || (iYear > END_YEAR))
                    { return -1;};
                    iMonth = m_Date.Month;
                    iDay = m_Date.Day;
                    Flag = gLunarHolDay[(iYear - START_YEAR) * 12 + iMonth - 1];
                    if (iDay < 15)
                    { Day = 15 - ((Flag >> 4) & 0x0f);}
                    else
                    {Day = (Flag & 0x0f) + 15;};
                    if (iDay == Day)
                    {
                        if (iDay > 15)
                        { return (iMonth - 1) * 2 + 1;}
                        else
                        { return (iMonth - 1) * 2;}
                    }
                    else
                    {return -1;};
                }
      
                public string FormatMonth(ushort iMonth, bool bLunar)
                {
                    string szText = "正二三四五六七八九十";
                    string strMonth;
                    if ((!bLunar) && (iMonth == 1))
                    { return "一月";}
                    if (iMonth <= 10)
                    {
                        strMonth = "";
                        strMonth = strMonth + szText.Substring(iMonth - 1, 1);
                        strMonth = strMonth + "月";
                        return strMonth;
                    }
                    if (iMonth == 11)
                    { strMonth = "十一";}
                    else
                    { strMonth = "十二";}
                    return strMonth + "月";
                } 
       
      
    首页 | 1 | 2 | 3 | 4 | 5 | 6 | 尾页  共 6 页
     
    winner 打印本页 关闭窗口

         文 章 评 论
    评论人 查看该文章的评论 发表时间
       笔 名* : 0 50分 60分 70分 80分 90分 100分
    评论内容 *: (最多1000字。当前字数:0)


    没有相关评论,欢迎您参与!

    - 关于本站 - 网站帮助 - 下载声明 - 友情连接 - 网站地图 -
    Copyright © 2005-2006 myTopWin.Com. All Rights Reserved . [桂ICP备06004496号]