Skip to Content
avatar image
Former Member

Need to subtract 15 minutes from a departure time

Hello all,

I need to subtract 15 minutes from a departure time. if my flight departs at 07:00 I need it to show a boarding time of 06:45. Below are the two formulas that I can use. I need to show both the departure time and boarding time on my form.

------------------------------------------------------------------------------

forumual 1 time field.

whileprintingrecords;
stringvar tm := "";
stringvar tntdept := "";


   tm := fos2time({TRIP_LEGS.ETD - local});

--------------------------------------------------------------------------------

formula 2 date and time field.

whileprintingrecords;
stringvar dt := "";
stringvar tm := "";
stringvar tntdept := "";

if not isnull({TRIP_LEGS.Depart Date - Local}) and  {TRIP_LEGS.Depart Date - Local} <> 0 then
(
    dt := uppercase(totext(fos2date({TRIP_LEGS.Depart Date - Local}),"ddd   dd MMM yyyy"));
    tm := fos2time({TRIP_LEGS.ETD - local});
    if {TRIP_LEGS.ETD Tentative} = 1 then tntdept := " ?" else tntdept := "  ";
)
else
    "";



dt + space(4) + tm + tntdept;

--------------------------------------------------------------------------------------------

Any help would be great.

Thanks

Bill

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 08, 2015 at 10:01 AM

    Hi,

    Try Using Below Formula.

    DateAdd('n', -15, {DateField})

    DateAdd (intervalType, nIntervals, startDateTime)

    Description

    A DateTime value.

    Arguments

    • intervalType is a String expression specifying the interval of time to be added. 
    • nIntervals is a Number or numeric expression specifying the number of intervals to be added. It can be positive (to get date-times in the future) or negative (to get date-times in the past). 
    • startDateTime is the DateTime value to which the intervals are to be added.

    Argument values

    • IntervalType values can be one of the following: 

      Interval type value

      Description

      yyyy

      Extracts the year

      q

      Quarter (the result is 1, 2, 3 or 4)

      m

      Month (the result is from 1 to 12)

      y

      Day of year (1 to 365 or 366 in a leap year)

      d

      Day part of the date (1 to 31)

      w

      Day of week (1 to 7 with the result depending on firstDayOfWeek)

      ww

      Week of year (1 to 53 with firstDayOfWeek and firstWeekOfYear determining the exact days of the first calendar week of the year)

      h

      Extracts the hour part of the given DateTime (0 to 23)

      n

      Minute part (0 to 59)

      s

      Second part (0 to 59)

    Add comment
    10|10000 characters needed characters exceeded