当前位置:主页>仓库管理软件> 列表

求有关Delphi日期加减的函数,各位大侠进来看看 找服装进销存软件破解

进销存软件版1楼: 在ASP编程种有这样一个情况,可以用DateAdd函数解决:
如下示例将 95 年 1 月 31 日加上一个月:
NewDate = DateAdd("m", 1, "31-Jan-95")

但是在Delphi中也有这样一个函数,可以对年,月,日 加减。我忘记这个函数了,请各位大侠赐教!

2楼: 查帮助,多数日期函数在dateUtils单元中 如服装进销存软件破解

3楼: uses dateUtils;

{ Increment/decrement datetime fields }

function IncYear(const AValue: TDateTime;
const ANumberOfYears: Integer = 1): TDateTime;
// function IncMonth is in SysUtils
function IncWeek(const AValue: TDateTime;
const ANumberOfWeeks: Integer = 1): TDateTime;
function IncDay(const AValue: TDateTime;
const ANumberOfDays: Integer = 1): TDateTime;
function IncHour(const AValue: TDateTime;
const ANumberOfHours: Int64 = 1): TDateTime;
function IncMinute(const AValue: TDateTime;
const ANumberOfMinutes: Int64 = 1): TDateTime;
function IncSecond(const AValue: TDateTime;


const ANumberOfSeconds: Int64 = 1): TDateTime;
function IncMilliSecond(const AValue: TDateTime;
const ANumberOfMilliSeconds: Int64 = 1): TDateTime;

4楼: DateUtils单元里面就有这些函数
如:IncDay IncWeek IncHour IncYear 等。

5楼: IncAMONTH(),IncDAY(),IncHour()

6楼: 楼上有理。顶

进销存软件版7楼: 谢谢各位了 但是我说的是对当前日期的 月份 或者 日 加减
NewDate = DateAdd("m", 3, "2006-1-16") 我希望的到的的NewDate 是“2006-4-16”
NewDate = DateAdd("d", 5, "2006-1-16") 则NewDate 是“2006-1-21”
这个DateAdd 是ASP里面的 这样的运用在Delphi里面不知道是什么函数,我用过这个函数,可是源码让联想的狗屁工程师把整个硬盘的数据都弄丢了!

各位指个明路啊!

8楼: NewDate = IncMonth(''2006-1-16'', 3)

Returns a date shifted by a specified number of months.

Unit

Sysutils

Category

date/time routines

function IncMonth(const Date: TDateTime; NumberOfMonths: Integer): TDateTime;

Description

IncMonth returns the value of the Date parameter, incremented by NumberOfMonths months. NumberOfMonths can be negative, to return a date N months previous.



If the input day of month is greater than the last day of the resulting month, the day is set to the last day of the resulting month. The time of day specified by the Date parameter is copied to the result.

9楼: THANKS ! I LOVE YOU!