转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> Delphi程序 >> 正文
日历函数单元         ★★★★

日历函数单元

作者:闵涛 文章来源:闵涛的学习笔记 点击数:2417 更新时间:2009/4/23 18:26:14
h));
  end;
  //计算日
  iDay := iDay + Word(iSpanDays);
end;

function l_GetLunarHolDay(iYear, iMonth, iDay: Word): Word;
var
  Flag: Byte;
  Day: Word;
begin
  Flag := gLunarHolDay[(iYear - START_YEAR) * 12 + iMonth - 1];
  if iDay < 15 then
    Day := 15 - ((Flag shr 4) and $0F)
  else
    Day := (Flag and $0F) + 15;
  if iDay = Day then
    if iDay > 15 then
      Result := (iMonth - 1) * 2 + 2
    else
      Result := (iMonth - 1) * 2 + 1
  else
    Result := 0;
end;

function GetLunarHolDay(InDate: TDateTime): string;
var
  i, iYear, iMonth, iDay: Word;
begin
  DecodeDate(InDate, iYear, iMonth, iDay);
  i := l_GetLunarHolDay(iYear, iMonth, iDay);
  case i of
    1: Result := ''''小寒'''';
    2: Result := ''''大寒'''';
    3: Result := ''''立春'''';
    4: Result := ''''雨水'''';
    5: Result := ''''惊蛰'''';
    6: Result := ''''春分'''';
    7: Result := ''''清明'''';
    8: Result := ''''谷雨'''';
    9: Result := ''''立夏'''';
    10: Result := ''''小满'''';
    11: Result := ''''芒种'''';
    12: Result := ''''夏至'''';
    13: Result := ''''小暑'''';
    14: Result := ''''大暑'''';
    15: Result := ''''立秋'''';
    16: Result := ''''处暑'''';
    17: Result := ''''白露'''';
    18: Result := ''''秋分'''';
    19: Result := ''''寒露'''';
    20: Result := ''''霜降'''';
    21: Result := ''''立冬'''';
    22: Result := ''''小雪'''';
    23: Result := ''''大雪'''';
    24: Result := ''''冬至'''';
  else
    Result := '''''''';
  end;
end;

function GetLunarHolDay(iYear, iMonth, iDay: Word): string;
begin
  Result := GetLunarHolDay(EncodeDate(iYear, iMonth, iDay));
end;

function GetConstellation(const DateTime: TDateTime): Integer;
var
  Y, M, D: Word;
begin
  DecodeDate(DateTime, Y, M, D);
  Y := M * 100 + D;
  if (Y >= 321) and (Y <= 419) then
    Result := 0
  else
    if (Y >= 420) and (Y <= 520) then
      Result := 1
    else
      if (Y >= 521) and (Y <= 620) then
        Result := 2
      else
        if (Y >= 621) and (Y <= 722) then
          Result := 3
        else
          if (Y >= 723) and (Y <= 822) then
            Result := 4
          else
            if (Y >= 823) and (Y <= 922) then
              Result := 5
            else
              if (Y >= 923) and (Y <= 1022) then
                Result := 6
              else
                if (Y >= 1023) and (Y <= 1121) then
                  Result := 7
                else
                  if (Y >= 1122) and (Y <= 1221) then
                    Result := 8
                  else
                    if (Y >= 1222) or (Y <= 119) then
                      Result := 9
                    else
                      if (Y >= 120) and (Y <= 218) then
                        Result := 10
                      else
                        if (Y >= 219) and (Y <= 320) then
                          Result := 11
                        else
                          Result := -1;
end;

function GetConstellationName(const Constellation: Integer): string;
begin
  case Constellation of
    0: Result := ''''白羊座'''';
    1: Result := ''''金牛座'''';
    2: Result := ''''双子座'''';
    3: Result := ''''巨蟹座'''';
    4: Result := ''''狮子座'''';
    5: Result := ''''处女座'''';
    6: Result := ''''天秤座'''';
    7: Result := ''''天蝎座'''';
    8: Result := ''''射手座'''';
    9: Result := ''''摩羯座'''';
    10: Result := ''''水瓶座'''';
    11: Result := ''''双鱼座'''';
  else
    Result := '''''''';
  end;
end;

function GetConstellationName(const DateTime: TDateTime): string;
begin
  Result := GetConstellationName(GetConstellation(DateTime));
end;

end.

上一页  [1] [2] [3] [4] 


没有相关教程
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台