比如:
2004-3-31
的上一月为
年:2004
月:2
2004-1-10
的上一月为
年:2003
月:12delphi里有没有这样的函数?
2004-3-31
的上一月为
年:2004
月:2
2004-1-10
的上一月为
年:2003
月:12delphi里有没有这样的函数?
解决方案 »
- sql 问题
- 一个获取图像范围的问题
- delphi的高手的博客
- 多线程调用web service出现错误提示:尚未调用 CoInitialize
- 关于指针的问题,十万火急!在线等待……
- 100分请教: 用IdFTP组件实现连接FTP服务器的问题---在线等待
- 急用————谁能提供李维的高效数据库程序设计中的示例数据库文件
- combobox 组件的一个小问题!!!但很急呀!!!
- 怎么模拟键盘?!
- 请问程序中如何得知已经连接上Internet网,我的机器是通过代理服务器上网的
- 字符串减法。奇怪的问题。怎么解决啊?
- 对DateTimePicker怎么设置才能使日期段和时间段均得到修改?问了N次均无人解答
function YearOf(const AValue: TDateTime): Word;
function MonthOf(const AValue: TDateTime): Word;function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
procedure GetPrevNy(var year,mon:string;d:TDateTime);
var
s:string;
begin
s:=FormatDateTime('yyyymm',StrToDate(FormatDateTime('yyyy-mm',d)+'-01')-1);
year:=Copy(s,1,4);
mon:=Copy(s,4,2);
end;
year:=Copy(s,1,4);
mon:=Copy(s,5,2);
DateUtilsshowmessage('今天的上一个月是' + inttostr(Yearof(incMonth(date, -1))) + '年' + inttostr(monthof(incMonth(date, -1))) + '月');