DateSubtract Method

Returns the date that precedes another date by a specified duration.

Syntax

expression**.DateSubtract(FinishDate, Duration, Calendar)**

*expression   *     Optional. An expression that returns an Application object.

FinishDate    Required Variant. The date used as the end of the duration.

Duration    Required Variant. The duration to subtract from the finish date.

Calendar    Optional Object. A resource, task, or base calendar object. The default value is the calendar of the active project.

Example

The following example displays the start date of a task that lasts three days and ends on 7/13/02 at 5:00 P.M.

Sub FindDuration()
    MsgBox DateSubtract("7/13/02 5:00 PM", "3d")
End Sub

Applies to | Application Object

See Also | DateAdd Method | DateDifference Method | DateFormat Method