枚举某一时间段的有多少正点
来源:互联网 发布:淘宝的全民晒单怎么晒 编辑:程序博客网 时间:2024/05/02 23:18
var
myDay:integer;
leepDay:integer;
StaDateTime,EndDateTime:TDateTime;
Year1,Month1,Day1,Hour1,Minute1,
Second1,MilliSecond1:Word;
Year2,Month2,Day2,Hour2,Minute2,
Second2,MilliSecond2:Word;
i,j:integer;
s1,s2:string;
d:double;
begin
StaDateTime:=StrToDateTime('2005-12-10 0:00:00');
EndDateTime:=StrToDateTime('2005-12-10 12:00:00');
DecodeDateTime(StaDateTime,Year1,Month1,Day1,Hour1,Minute1,Second1,MilliSecond1);
DecodeDateTime(EndDateTime,Year2,Month2,Day2,Hour2,Minute2,Second2,MilliSecond2);
if EndDateTime-StaDateTime<=0 then d:=0 else
d:=EndDateTime-StaDateTime;
s1:=FloatToStr(d);
s1:=Copy(S1,1,Pos('.',s1)-1);
i:=StrToInt(s1);
i:=i*24;
if Hour2-Hour1>0 then i:=i+Hour2-Hour1 else
i:=i+24+Hour2-Hour1;
i:=i+1;
if i>744 then i:=0;
for j:=1 to i-1 do
begin
if Hour1<23 then
Hour1:=Hour1+1
else
begin
if Year1 mod 4=0 then leepDay:=29 else leepDay:=28;
//判断月份的天数。
case Month1 of
1: myDay:=31;
2: myDay:=leepDay;
3: myDay:=31;
4: myDay:=30;
5: myDay:=31;
6: myDay:=30;
7: myDay:=31;
8: myDay:=31;
9: myDay:=30;
10: myDay:=31;
11: myDay:=30;
12: myDay:=31;
end;
if Hour1+1=24 then
begin
if Day1<myDay then
begin
if Month1<12 then
begin
Day1:=Day1+1;
end else
begin
Year1:=Year1+1;
Month1:=1;
end;
end else
begin
if Month1<12 then
begin
Month1:=Month1+1;
end else
begin
Year1:=Year1+1;
Month1:=1;
end;
Day1:=1;
end;
Hour1:=0;
end;
end;
S2:=IntToStr(Year1)+'-'+IntToStr(Month1)+'-'+IntToStr(Day1)+' '+IntToStr(Hour1)+':00:00';
ShowMessage(s2);
end;
end;
myDay:integer;
leepDay:integer;
StaDateTime,EndDateTime:TDateTime;
Year1,Month1,Day1,Hour1,Minute1,
Second1,MilliSecond1:Word;
Year2,Month2,Day2,Hour2,Minute2,
Second2,MilliSecond2:Word;
i,j:integer;
s1,s2:string;
d:double;
begin
StaDateTime:=StrToDateTime('2005-12-10 0:00:00');
EndDateTime:=StrToDateTime('2005-12-10 12:00:00');
DecodeDateTime(StaDateTime,Year1,Month1,Day1,Hour1,Minute1,Second1,MilliSecond1);
DecodeDateTime(EndDateTime,Year2,Month2,Day2,Hour2,Minute2,Second2,MilliSecond2);
if EndDateTime-StaDateTime<=0 then d:=0 else
d:=EndDateTime-StaDateTime;
s1:=FloatToStr(d);
s1:=Copy(S1,1,Pos('.',s1)-1);
i:=StrToInt(s1);
i:=i*24;
if Hour2-Hour1>0 then i:=i+Hour2-Hour1 else
i:=i+24+Hour2-Hour1;
i:=i+1;
if i>744 then i:=0;
for j:=1 to i-1 do
begin
if Hour1<23 then
Hour1:=Hour1+1
else
begin
if Year1 mod 4=0 then leepDay:=29 else leepDay:=28;
//判断月份的天数。
case Month1 of
1: myDay:=31;
2: myDay:=leepDay;
3: myDay:=31;
4: myDay:=30;
5: myDay:=31;
6: myDay:=30;
7: myDay:=31;
8: myDay:=31;
9: myDay:=30;
10: myDay:=31;
11: myDay:=30;
12: myDay:=31;
end;
if Hour1+1=24 then
begin
if Day1<myDay then
begin
if Month1<12 then
begin
Day1:=Day1+1;
end else
begin
Year1:=Year1+1;
Month1:=1;
end;
end else
begin
if Month1<12 then
begin
Month1:=Month1+1;
end else
begin
Year1:=Year1+1;
Month1:=1;
end;
Day1:=1;
end;
Hour1:=0;
end;
end;
S2:=IntToStr(Year1)+'-'+IntToStr(Month1)+'-'+IntToStr(Day1)+' '+IntToStr(Hour1)+':00:00';
ShowMessage(s2);
end;
end;
- 枚举某一时间段的有多少正点
- 求某一年的某一月有多少天问题
- 计算某一年的某一月有多少天。
- 某一时间段的取平均值
- java 两个时间段有多少天
- 查看树的某一节点下有多少子节点
- 输出某一时间段内的所有时间
- linux下删除某一时间段的文件
- 批量修改某一时间段内的数据
- linux下删除某一时间段的文件
- 统计某一时间段内的数据
- linux下拷贝某一时间段的文件
- 计算某一月有多少天
- 获取某一年某一月有多少天
- 判断一个时间段内有多少个周末
- 根据两个时间段,取这两个时间段内有多少个月份
- C#关于日期月天数和一年有多少周及某年某周时间段的计算
- C#关于日期月天数和一年有多少周及某年某周时间段的计算
- wget 使用技巧集锦
- dnn汉化
- Apache模块索引
- Tomcat简介
- linux的动态库编译方法 shared object
- 枚举某一时间段的有多少正点
- IIS操作代码
- apxs - Apache 扩展工具
- NetMos 9845 VxWorks驱动
- 如何定位list中数据单元
- 使用ASP生成 GUID
- 网络版《黄建翔解说》
- Enterprise JavaBeans v3.0 - Foreword
- Iterator中的有价值的几个函数