📄 datecn.pas
字号:
If day = 11 Then
result := '人口日';
End;
8:
Begin
End;
9:
Begin
If day = 8 Then
result := '扫盲日';
If day = 17 Then
result := '和平日';
If day = 20 Then
result := '爱牙日';
If day = 22 Then
result := '聋人节';
If day = 27 Then
result := '旅游日';
End;
10:
Begin
If day = 6 Then
result := '老人节';
If day = 4 Then
result := '动物日';
If day = 7 Then
result := '住房日';
If day = 9 Then
result := '邮政日';
If day = 15 Then
result := '盲人节';
If day = 16 Then
result := '粮食日';
End;
11:
Begin
If day = 8 Then
result := '记者日';
If day = 9 Then
result := '消防日';
If day = 17 Then
result := '大学生';
End;
12:
Begin
If day = 9 Then
result := '足球日';
If day = 24 Then
result := '平安夜';
End;
End;
End;
Function Holiday(Date: TDateTime; Day: integer): String;
Var
dDate: TDate;
Begin
result := '';
// result := OtherHoliday(Month(Date), Day);
Case Month(Date) Of
1:
Begin
If day = 1 Then
result := '元旦节';
End;
2:
Begin
If day = 14 Then
result := '情人节';
End;
3:
Begin
If day = 8 Then
result := '妇女节';
End;
4:
Begin
If day = 1 Then
result := '愚人节';
End;
5:
Begin
If day = 1 Then
result := '劳动节';
If day = 4 Then
result := '青年节';
// 母亲节[第二个星期日]
dDate := EnCodeDate(Year(Date), Month(Date), Day);
If (DayOfWeek(dDate) = 1) Then
If (Trunc((Day - 1) / 7) = 1) Then
result := '母亲节';
End;
6:
Begin
If day = 1 Then
result := '儿童节';
// 父亲节[第三个星期日]
dDate := EnCodeDate(Year(Date), Month(Date), Day);
If (DayOfWeek(dDate) = 1) Then
If (Trunc((Day - 1) / 7) = 2) Then
result := '父亲节';
End;
7:
Begin
If day = 1 Then
result := '建党节';
End;
8:
Begin
If day = 1 Then
result := '建军节';
End;
9:
Begin
If day = 10 Then
result := '教师节';
End;
10:
Begin
If day = 1 Then
result := '国庆节';
If day = 6 Then
result := '老人节';
If day = 31 Then
result := '万圣节';
End;
11:
Begin
If day = 8 Then
result := '记者日';
// 感恩节(11月的第四个星期四 )
dDate := EnCodeDate(Year(Date), Month(Date), Day);
If (DayOfWeek(dDate) = 5) Then
If (Trunc((Day - 1) / 7) = 3) Then
result := '感恩节';
End;
12:
Begin
If day = 25 Then
result := '圣诞节';
End;
End;
End;
Function GetCnDateToDate(dDate: TDateTime): TDateTime;
Begin
Result := GetCnDateToDate(Year(Now), CnMonth(dDate), CnDay(dDate));
End;
Function GetCnDateToDate(cYear, cMonth, cDay: word): TDateTime;
Var
tempDate: TDateTime;
tempDay, tempMonth: Integer;
Begin
If cMonth > 11 Then
tempDate := EnCodeDate(cYear - 1, cMonth, cDay)
Else
tempDate := EnCodeDate(cYear, cMonth, cDay);
Result := 0;
tempMonth := 0;
tempDay := 0;
While Result = 0 Do
Begin
tempDate := tempDate + 1;
If CnMonth(tempDate) = cMonth Then
If CnDay(tempDate) = cDay Then
Begin
Result := tempDate;
exit;
End
Else
If (cDay = 30) And (CnDay(tempDate) = 29)
And (CnDay(tempDate + 1) <> 30) Then
Begin
//如果是没有30(闰月),就提前一天
Result := tempDate;
exit;
End;
End;
End;
Function GetDays(ADate: TDate): Extended;
Var
FirstOfYear: TDateTime;
Begin
FirstOfYear := EncodeDate(StrToInt(FormatDateTime('yyyy', now)) - 1, 12, 31);
Result := ADate - FirstOfYear;
End;
Function Constellation(Date: TDateTime; Day: integer): String; overload;
Var
Year, Month, Days, Hour: Word;
Begin
DecodeDate(Date, Year, Month, Days);
Result := Constellation(EncodeDate(Year, Month, Day));
end;
Function Constellation(ADate: TDate): String;
Begin
Case Month(ADate) Of
1:
Begin
If day(ADate) <= 19 Then
result := '摩羯座';
If day(ADate) >= 20 Then
result := '水瓶座';
End;
2:
Begin
If day(ADate) <= 18 Then
result := '水瓶座';
If day(ADate) >= 19 Then
result := '双鱼座';
End;
3:
Begin
If day(ADate) <= 20 Then
result := '双鱼座';
If day(ADate) >= 21 Then
result := '白羊座';
End;
4:
Begin
If day(ADate) <= 19 Then
result := '白羊座';
If day(ADate) >= 20 Then
result := '金牛座';
End;
5:
Begin
If day(ADate) <= 20 Then
result := '金牛座';
If day(ADate) >= 21 Then
result := '双子座';
End;
6:
Begin
If day(ADate) <= 21 Then
result := '双子座';
If day(ADate) >= 22 Then
result := '巨蟹座';
End;
7:
Begin
If day(ADate) <= 22 Then
result := '巨蟹座';
If day(ADate) >= 23 Then
result := '狮子座';
End;
8:
Begin
If day(ADate) <= 22 Then
result := '狮子座';
If day(ADate) >= 24 Then
result := '处女座';
End;
9:
Begin
If day(ADate) <= 22 Then
result := '处女座';
If day(ADate) >= 23 Then
result := '天秤座';
End;
10:
Begin
If day(ADate) <= 23 Then
result := '天秤座';
If day(ADate) >= 24 Then
result := '天蝎座';
End;
11:
Begin
If day(ADate) <= 21 Then
result := '天蝎座';
If day(ADate) >= 22 Then
result := '射手座';
End;
12:
Begin
If day(ADate) <= 21 Then
result := '射手座';
If day(ADate) >= 22 Then
result := '摩羯座';
End;
End;
End;
{
//存储星座配信息
1白羊座: 03月21日-------04月19日 Aries
2金牛座: 04月20日-------05月20日 Taurus
3双子座: 05月21日-------06月21日 Gemini
4巨蟹座: 06月22日-------07月22日 Cancer
5狮子座: 07月23日-------08月22日 Leo
6处女座: 08月23日-------09月22日 Virgo
7天秤座: 09月23日-------10月23日 Libra
8天蝎座: 10月24日-------11月21日 Scorpio
9射手座: 11月22日-------12月21日 Sagittarius
10摩羯座: 12月22日-------01月19日 Capricorn
11水瓶座: 01月20日-------02月18日 Aquarius
12双鱼座: 02月19日-------03月20日 Pisces
}
End.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -