FB_ALY_DateTime
Function block to store and process timestamps. Timestamps are stored as raw values in accuracy of 1ns. Using the methods of this FB the timespan can be modified, compared or formatted.
Methods
Name | Definition Location | Description |
---|---|---|
AddRaw | Local | Method to add a timespan in raw format. |
AddTimespan | Local | Method to add a timespan stored in FB_ALY_Timespan |
SubRaw | Local | Method to subtract a timespan in raw format. |
SubTimespan | Local | Method to subtract a timespan stored in FB_ALY_Timespan |
EqualsTo | Local | Method to compare two timestamps. |
ToString | Local | Method to format the current raw value as string. |
Sample
VAR
fbDateTime : FB_ALY_DateTime;
fbSystemTime : FB_ALY_GetSystemTime;
sFormattedDateTime : STRING(29);
END_VAR
// Get current system time
fbSystemTime.Call();
fbDateTime.nRaw := fbSystemTime.tSystemTime;
fbDateTime.AddRaw(TO_LINT(LTIME#1H));
sFormattedDateTime := fbDateTime.ToString()
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |
Further Information