大家好,小弟刚学习Delphi不久,处于菜鸟阶段,问一下大家
用Delphi代码如何把年周转换成本周第一天的日期?(以周日为第一天)
如0917(09年17周)转换成20090517(2009年5月17日)
用Delphi代码如何把年周转换成本周第一天的日期?(以周日为第一天)
如0917(09年17周)转换成20090517(2009年5月17日)
解决方案 »
- 高分寻找触摸屏相关的开发资料
- 有没有既懂DELPHI又懂C++的兄弟啊?来帮忙看看这段代码!关于读取二进制图片的!
- 用IdTCPServer和IdTCPClient传输大文件时出问题了,怎么办?
- 怎么在程序初始化的时候定义一个全局的字符串数组?
- ImageList的图片色彩模式和显示清晰度的问题
- delphi 怎么实现,字符串转换成十六进制???
- 请问怎么返回一个字符串数组
- 一个很简单的问题,在delphi中如何实现continue,break
- 请教各位老大,我目前使用indy向一个网页.asp post数据,如何发送字符"&"
- 关于三层数据库,急!!!
- 新手请教大侠们:使用SPCOMM控件中发送数据的问题。。。^_^
- 大家请帮帮忙,如何将十六进制的字符串转化成十六进制的值
s:string;
dt:TDate;
begin
dt:=StrToDate('2009-1-1')+(2*7);
s:=DateToStr(dt);
end;
先取出17这个值
dt:=StartOfAWeek(2009,17,7);//7表示取周日
原型
function StartOfAWeek(const AYear, AWeekOfYear: Word; const ADayOfWeek: Word = 1): TDateTime;
DescriptionStartOfAWeek returns the first expressible moment (12:00:00.000 AM) of the specified day of the specified week.The AYear parameter specifies the year of the desired day.The AWeekOfYear parameter specifies the week of the year, where 1 is the first week in AYear that includes four or more days.The ADayOfWeek parameter indicates the desired day in the specified week, where 1 is Monday, 2 is Tuesday, and so on.
s:string;
dt:TDate;
i:Integer;
begin
dt:=StrToDate('2009-1-1');
i:=DayOfWeek(dt);
self.Label3.Caption:=IntToStr(i);
dt:=StrToDate('2009-1-1')+(7-i+16*7);//这个就是09年17周第一天
s:=DateToStr(dt);
i:=DayOfWeek(dt);
self.Label1.Caption:=s;
self.Label2.Caption:=IntToStr(i);
dt:=StrToDate('2009-1-1')+(7-i+1+16*7);//这个就是09年17周第一天然后用 DecodeDate(dt1,year,mon,day);
拆离出年、月、日,组合起来就行了
StartOfAWeek(2009,17,7);返回2009年第17周的周日 2009-04-26