用procedure DecodeDate(Date: TDateTime; var Year, Month, Day: Word);
试试
Returns Year, Month, and Day values for a TDateTime value.
试试
Returns Year, Month, and Day values for a TDateTime value.
解决方案 »
- 一个对日外包项目的困惑!!
- 为什么我的英文版软件,在我自己的中文操作系统下,输入的汉字变成了乱码?
- OLE打开Word文档的怪问题
- 调查问卷:请问大家所在的公司有用C/S三层结构的吗?
- 各位老大,是否有方法能保证delphi在调试出错的时候,一定停在出错的行上。现在我遇到了出错但不知在哪的问题
- 调用DLL时出错?
- 怎样读取系统(2000,98)中的输入法?如何判断是否处于大写状态?
- 谁用过robert算子?能讲讲是什么意思?
- 请教delphi数据库设计方案!
- 一个SQL语句的问题,急死我了,请帮帮忙!!!
- 一个关于数据库的问题,望各位高手多多指教.(很急)
- 用WordApplication时怎样屏蔽掉Word的菜单,还有怎样控制word在Delphi中的Form中打开
截出MM
确定区间
var xmonth:string;
year,month,day:word;
xdate:tdate;
begin
xdate:=datetimepicker1.date;
decodedate(xdate,year,month,day);
case month of
1:xmonth='4月份';
...
12:xmonth='12月份';
end;
result:=xmonth;
end;
DateUtils;procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
Memo1.Clear;
for I := MonthOf(StrToDate('2002-04-01')) to MonthOf(StrToDate('2002-08-09')) do
Memo1.Lines.Add(Format('%d月份', [I]));
end;
Yearof(Tdatetime)
Dayof(Tdatetime)
weekof(Tdatetime)
decodedate(a,y,m1,d);
decodedate(b,y,m2,d);
for i := m1 to m2 do s := s := inttostr(i) + '月'#13;
showmessage(s);
如要去掉月份前面的0则改成: IntToStr(StrToInt(Copy(a,6,2)))+'月份'
你可以使用EncodeDate把录入的转换为日期型(也许录入时
就已经是日期型的),然后使用FormatDatetime函数转化格
式为'yyyy-mm-dd',按照楼上的做法补全中间的月份就行了。