🎒 SchoolNEW 💡 Suggest

TIME, LTIME, DATE, TOD, DT and DTL

Type a duration to see it as TIME (DINT in ms) and LTIME (LINT in ns). Type a date and time to see, byte by byte, how DATE, TOD, DT and DTL store it.

TIME and LTIME: durations

TIMET#1h30m
ms5400000

Date and time: DATE, TOD, DT and DTL byte by byte

DTL · 12 byte

0–1YEARUINT07 EA2026

DT (DATE_AND_TIME) · 8 byte BCD

0YEARBCD262026

Indicative results: always verify with a qualified technician and the applicable standards. Legal notice

TIME and LTIME

TIME is a DINT counting milliseconds, signed: from T#-24d20h31m23s648ms to T#24d20h31m23s647ms. It is written with the units in decreasing order: T#1d2h3m4s5ms. LTIME (S7-1500, Codesys) is an LINT in nanoseconds and reaches more than 106751 days. Beware of Codesys, where TIME is unsigned (0 … T#49d17h2m47s295ms).

DATE and TOD

In Siemens DATE is a UINT with the days since 1990-01-01 (D#2026-11-19 = 13471 = 16#349F) and TOD (TIME_OF_DAY) a UDINT with the milliseconds since midnight (TOD#12:38:00.000 = 45480000 = 16#02B5F840). In Codesys DATE counts seconds since 1970 in 32 bits and TOD counts milliseconds.

DT: 8 bytes in BCD

DATE_AND_TIME on classic S7 is made of 8 BCD bytes: year (90–99 = 1990–1999, 00–89 = 2000–2089), month, day, hour, minute, second, two millisecond digits; the last byte holds the third millisecond digit and the weekday (1 = Sunday). Thursday 2026-11-19 12:38:00 becomes 26 11 19 12 38 00 00 05: you can read it by eye in hex.

DTL: 12 binary bytes

DTL (S7-1200/1500) is a structure: YEAR UINT, MONTH, DAY, WEEKDAY, HOUR, MINUTE, SECOND USINT and NANOSECOND UDINT, 12 bytes in total. The same date becomes 07 EA 0B 13 05 0C 26 00 00 00 00 00. It is read with RD_SYS_T (UTC) or RD_LOC_T (local time). Exchanging it over Modbus takes 6 registers; to paste bytes and decode them use the decoder.

Frequently asked questions

How many bytes does a DTL use?

12 bytes: year (UINT, 2 bytes), month, day, weekday, hour, minute, second (USINT, 1 byte each) and nanoseconds (UDINT, 4 bytes).

What is the maximum TIME?

T#24d20h31m23s647ms, i.e. 2147483647 ms (2³¹ − 1): TIME is a DINT in milliseconds. The minimum is T#-24d20h31m23s648ms. In Codesys TIME is unsigned and goes up to T#49d17h2m47s295ms.

How is a Siemens DATE stored?

As a UINT with the number of days since 1 January 1990: D#2026-11-19 = 13471 = 16#349F. The range is D#1990-01-01 to D#2168-12-31.

Which number is Sunday in DTL?

In DTL and DT the weekday goes from 1 = Sunday to 7 = Saturday. When writing (WR_SYS_T, WR_LOC_T) the PLC ignores it and recalculates it.

How do I read the CPU time?

On S7-1200/1500 with RD_SYS_T (system time, UTC) or RD_LOC_T (local time) into a DTL variable. On S7-300/400 with READ_CLK into a DT. On Rockwell with GSV WallClockTime LocalDateTime into a DINT[7].

What do you think?

Your rating