FB_Time

FB_Time 1:

Class (FB) saves a point in time. The class makes it possible to interpret the time in various partial information and data types.

Syntax:

FUNCTION_BLOCK FB_Time

FB_Time 2: Properties

Name

Type

Access

Initial value

Description

Day

WORD

Get

0 (1 - 32)

Day of the month.

DayOfWeek

WORD

Get

0 (0 - 6)

Day of the week

0 = Sunday, 1 = Monday, etc…

DnT

DATE_AND_TIME

Get

DT#1970-1-1-0:0:0

Time as IEC data type.

Filetime

ULINT

Get, Set

0

Time as T_FILETIME64.

Hour

WORD

Get

0 (1 - 23)

Hour of the day.

Milisecond

WORD

Get

0 (1 – 999)

Millisecond of the second.

Minute

WORD

Get

0 (0 – 59)

Minute of the hour.

Month

WORD

Get

0 (1 – 12)

Month of the year.

Second

WORD

Get

0 (0 – 59)

Second of the minute.

Text

STRING(24)

Get

„1601-00-00-00:00:00“

Time as a textual string.

TimeOfDay

LREAL

Get

0 [s]

Time of day in seconds.

Timestruct

TIMESTRUCT

Get, Set

0x0

Time as system time structure.

ValidTime

BOOL

Get

FALSE

Time is valid (> 0).

Weekday

E_Weekday

Get

eNone

Day of the week

Year

WORD

Get

0 (1970 – 2106)

Year

FB_Time 3: Methods

Type

Description

DiffTo(iDiff)

Returns a timespan [s] between this and the transferred time.

DiffToNew()

Returns a timespan [s] between this time and the current local system time.

Now()

Sets this class equal to the current system time and returns an interface to it.

FB_Time 4: Interfaces

Type

Description

I_Time

Standard interface on FB_Time.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT >= v3.1.4024.54 (recommended)
TwinCAT >= v3.1.4024.42 (required)

PC or CX (x64, x86)

Tc3_PlasticBaseApplication (>= v12.8.1.0)