DTCurDateTime

 Function Block - Get the present date and time stamp.

Inputs

Input

Data Type

Range Unit Default

Description

Local

BOOL

FALSE, TRUE

N/A

No default

  • TRUE if local time is requested.
  • FALSE if GMT is requested.

Outputs

Output

Data Type

Range Unit

Description

Year

DINT

1900 to 2200

Years

Present year.

Month

DINT

1 to 12

Months

Present month.

Day

DINT

1 to 31

Days

Present day.

Hour

DINT

0 to 23

Hours

Present time: hours.

Min

DINT

0 to 59

Minutes

Present time: minutes.

Sec

DINT

0 to 60

Seconds

Present time: seconds.

MSec

DINT

0 to 999

Milliseconds

Present time: milliseconds.

TmOfDay

TIME

0 to 86,399,999

Milliseconds

Present time of day (milliseconds since midnight).

DST

BOOL

FALSE, TRUE

N/A

Indicates if the time is in:

  • Daylight saving time (DST = TRUE)
  • Standard time (DST = FALSE)

Remarks

None

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

Inst_DTCurDateTime(useLocalTime);
localYear    := Inst_DTCurDateTime.Year;
localMonth   := Inst_DTCurDateTime.Month;
localDay     := Inst_DTCurDateTime.Day;
localHour    := Inst_DTCurDateTime.Hour;
localMin     := Inst_DTCurDateTime.Min;
localSec     := Inst_DTCurDateTime.Sec;
localMSec    := Inst_DTCurDateTime.MSec;
localTmOfDay := Inst_DTCurDateTime.TmOfDay;
localDST     := Inst_DTCurDateTime.DST;