Adjust Method (DATETIME)


10.3A, PLBCMP GUI Only

 

The Adjust method changes the time and date stored in a DATETIME object. The method uses the following format:

 

[label]

{object}.Adjust

[GIVING {return}] USING [*Value=]{value}

 

Where:

label

Optional. A Program Execution Label.

object

Required. A DATETIME object that has previously been declared.

return

Optional. A Numeric Variable that returns an error value if this method fails.

value

Required. A Character String Variable or literal that specifies what adjustments should be made to the time and date.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The ZERO flag is set with a return value of zero. When ZERO flag is cleared, a non-zero value indicates an error has occurred and the error values are found in the DATETIME object notes.

  2. The OVER flag is set if the {return} variable is too small to store that value without being truncated.

  3. The EOS flag is always cleared.

  4. Value is comma separated list time modifiers, that are applied from left to right.

  5. The available modifiers are as follows:

  6.  

    Modifier

    Description

    [+-]NNN years

    Number of years added to or subtracted from the date

    [+-]NNN months

    Number of months added to or subtracted from the date

    [+-]NNN days

    Number of days added to or subtracted from the date

    [+-]NNN hours

    Number of hours added to or subtracted from the date

    [+-]NNN minutes

    Number of minutes added to or subtracted from the date

    [+-]NNN seconds

    Number of seconds added to or subtracted from the date

    [+-]NNN.NNNN seconds

    Number of seconds (and fractional seconds) added to or subtracted from the date

    start of year

    Shifts the date back to the start of the year

    start of month

    Shifts the date back to the start of the month

    start of day

    Shifts the date back to the start of the day

    weekday N

    Moves the date forward to the next weekday number N (0 = Sunday - 6 = Saturday)

    Linuxepoch

    Used with the DDDDDDDDDD value given in a SetAsString method to interpret the date as Linux Time (ie: number of seconds since 1970-01-01)

    localtime

    Adjusts date to local time, assuming the DATETIME was expressed in UTC time

    utc

    Adjusts date to UTC time, assuming the DATETIME was expressed in local time

Example:

 

dt DATETIME

      dt.Adjust Using "localtime, start of month, weekday 2, 1 days, weekday 2"

 

 

See Also: Method Syntax, DATETIME Methods

 



PL/B Language Reference Compare Method (DATETIME)