Adjust Method for LCDatetime
This method alters a datetime by specified datetime units.
Defined In
LCDatetime
Syntax
Call changeDatetime.Adjust (Units, Amount)
Parameters
Parameter |
Description |
---|---|
Units |
Long. The unit to adjust. Units are in the order listed in the constructor: Year, Month, Day, Hour, Minute, Second, Hundredth, Zone, DST. Use the following constants: |
LCDTUNIT_YEAR -- Year units. |
|
LCDTUNIT_MONTH -- Month units. |
|
LCDTUNIT_DAY -- Day units. |
|
LCDTUNIT_HOUR -- Hour units. |
|
LCDTUNIT_MINUTE -- Minute units. |
|
LCDTUNIT_SECOND -- Second units. |
|
LCDTUNIT_HUNDREDTH -- Hundredth of second units. |
|
Amount |
Long. The amount to adjust the datetime unit. Positive means later in time; negative means earlier. |
Usage Notes®
The LCDatetime.Adjust method does not support time zone adjustment. You have to do this yourself by setting the Zone property and adjusting the time by an appropriate number of hours.
LCDatetime is limited to the capabilities of time representation in relational database systems. This representation is not as rich as the NotesDateTime object and Notes® datetime fields. If you need to do much math with dates and times, it is probably better to create NotesDateTime objects, which allow easier time zone conversions and control of whether Daylight Savings Time should be applied when adjusting.
Example
Option Public
Uselsx "*lsxlc"
Sub Initialize
Dim clock As New LCDateTime
clock.SetCurrent
Print "The time is " & clock.Text
Call clock.Adjust (LCDTUNIT_HOUR, -100)
Print "100 hours ago, the time was " & clock.Text
End Sub
Example Output
The time is 09/08/1998 05:22:07.18 PM
100 hours ago, the time was 09/05/1998 02:37:52.82 AM