var
//::::::::::::::::::::::::::::::::::::::::::::::::::://
date_min:string='2009-02-13'; // 使用期限最小日期
date_max:string='2009-12-15'; // 使用期限最大日期
//::::::::::::::::::::::::::::::::::::::::::::::::::://
if (dateof(now)>=strtodate(date_max)) or (dateof(now)<=strtodate(date_min)) then
begin
statusbar1.Panels[1].Text:='软件超过使用有效期'
end;如上代码用delphi7在xp下编译, 使用正常, 但程序到vist系统运行时就提示 2009-12-15 不是一个有效的数值一样的提示,只要我注释掉这段代码整个程序在vista下是没有问题的。 求解决在vista下通用的解决办法.
//::::::::::::::::::::::::::::::::::::::::::::::::::://
date_min:string='2009-02-13'; // 使用期限最小日期
date_max:string='2009-12-15'; // 使用期限最大日期
//::::::::::::::::::::::::::::::::::::::::::::::::::://
if (dateof(now)>=strtodate(date_max)) or (dateof(now)<=strtodate(date_min)) then
begin
statusbar1.Panels[1].Text:='软件超过使用有效期'
end;如上代码用delphi7在xp下编译, 使用正常, 但程序到vist系统运行时就提示 2009-12-15 不是一个有效的数值一样的提示,只要我注释掉这段代码整个程序在vista下是没有问题的。 求解决在vista下通用的解决办法.
用
var
//::::::::::::::::::::::::::::::::::::::::::::::::::://
date_min:string='2009-02-13'; // 使用期限最小日期
date_max:string='2009-12-15'; // 使用期限最大日期
//::::::::::::::::::::::::::::::::::::::::::::::::::://
if (formatDateTime('YYYY-MM-DD'now) >= date_max) or (FormatDateTime('YYYY-MM-DD',now) <= date_min) then
begin
statusbar1.Panels[1].Text:='软件超过使用有效期'
end; 這樣處理,或者在軟件找開的時候就把操作系統的日期調成你的格式。他的顯示格式有一些出入。在控制面板日期調整裏。
使用formatDateTime(ShortDateFormat, now)判断