Tip>Designer

Determining the time elapsed between two dates

 

Article #:

0026

Contributor:

Joanne Irvine-Smith

GF version:

All

Applies to:

Date and Time tasks

Last updated:

December 19, 2001

Description

Determine the number of days, hours and minutes that have elapsed between two dates.

Explanation

Using the Date and Time tasks, you can set up FillPoints that will use the system date and time to determine the time that has elapsed between an original date and the date at run time.

 

Click here to view the example.

opens the calendar interface and allows you to browse through the calendar to choose an original date. The time portion of a date selected in this way is always 12 am. You can add half a day to the Date to get 12 pm:

%[DateOpened=DateOpened+0.5]

stores the current system date and time in the DateClosed variable.

This task determines the number of days between the two dates.

%[DateDif=DateClosed-DateOpened)]

The result of this subtraction can then be formatted as hours and minutes:

Hours and minutes: %[FormatTime(DateDif,'h:mm')]