日期设置(简单)(50分)

Y

yutsing

Unregistered / Unconfirmed
GUEST, unregistred user!
请教:
本人在窗体中添加DateTimePicker,在窗体运行时显示当前日期当月一日的时间
如:今天是:2002年12月17日,则显示:2002年12月1日

谢谢
 
简单!
---------------
var
year,month,day:word; //要用word型
begin
DecodeDate(DateTimePicker1.Date,Year, Month, Day); //拆解
DateTimePicker1.Date:=EncodeDate(Year, Month, 1); //合并
end;
==========================
给分吧!
 
DateTimePicker.Date := StrToDate(formatDatetime('YYYY-MM',Date)+'-01')
 
多人接受答案了。
 
这分太好拿了。
 
顶部