S7 Siemens PLC Date/Time Utility

Siemens DATE_AND_TIME Decoder

Decode and encode the classic Siemens S7 DATE_AND_TIME 8-byte BCD format. Inspect year, month, day, hour, minute, second, millisecond and weekday fields and validate the encoded calendar date.

✓ 8-Byte Format ✓ BCD Validation ✓ 1990–2089 ✓ Milliseconds ✓ Weekday ✓ Encode & Decode
DT
S7 DATE_AND_TIME Decode / Encode
● Ready
Enter exactly eight hexadecimal bytes. Spaces, commas, colons, hyphens, continuous hexadecimal and 0x-prefixed bytes are accepted.
Supported classic DATE_AND_TIME range: 1990–2089.
Byte 7 is shared: its high nibble contains the final millisecond digit and its low nibble contains the weekday. Therefore milliseconds are decoded as BCD(Byte 6) × 10 + high nibble of Byte 7.
Siemens DATE_AND_TIME Result Decoded
Decoded Date and Time
Year
Month
Day
Weekday
Hour
Minute
Second
Milliseconds
Year BCD
Date Validity
Weekday Check
Total Length
8-Byte DATE_AND_TIME Value
Byte-Level Breakdown

What Is Siemens S7 DATE_AND_TIME?

DATE_AND_TIME is a classic Siemens S7 date and time representation occupying eight bytes. Its calendar and clock fields are stored primarily using packed BCD, or Binary Coded Decimal.

The format carries year, month, day, hour, minute, second, milliseconds and a weekday value.

Siemens DATE_AND_TIME 8-Byte Format

Byte 0 Year Byte 1 Month Byte 2 Day Byte 3 Hour Byte 4 Minute Byte 5 Second Byte 6 Millisecond hundreds/tens Byte 7 Millisecond units + Weekday

Bytes 0 through 6 use packed BCD. The final byte combines two different fields: the high nibble stores the last millisecond digit and the low nibble stores the day of the week.

What Is Packed BCD?

Packed Binary Coded Decimal stores two decimal digits in one hexadecimal byte. Each nibble must therefore contain a value from 0 through 9.

Hex byte: 47 High nibble: 4 Low nibble: 7 BCD value: 47 decimal

A value such as 4A is not valid packed BCD because hexadecimal A cannot represent a decimal BCD digit.

DATE_AND_TIME Year Mapping

Only two decimal year digits are physically stored. Siemens’ classic DATE_AND_TIME range maps them across the years 1990 through 2089.

Stored 90–99 → 1990–1999 Stored 00–89 → 2000–2089

For example, BCD byte 24 represents the year 2024, while 95 represents 1995.

Month, Day and Time Fields

Field Valid Decoded Range
Month1–12
DayValid calendar day for selected month/year
Hour0–23
Minute0–59
Second0–59
Milliseconds0–999
Weekday1–7

How Milliseconds Are Stored

Milliseconds span byte 6 and the upper nibble of byte 7.

Example: Byte 6 = 12 Byte 7 high nibble = 3 BCD(Byte 6) = 12 Milliseconds = 12 × 10 + 3 = 123 ms

The lower nibble of byte 7 is not part of milliseconds; it contains the weekday.

Siemens DATE_AND_TIME Weekday

Value Weekday
1Sunday
2Monday
3Tuesday
4Wednesday
5Thursday
6Friday
7Saturday

The calculator also independently computes the weekday from the decoded calendar date and reports whether the stored weekday agrees with it.

DATE_AND_TIME Decode Example

24 09 02 14 35 47 12 32 24 Year = 2024 09 Month = 9 02 Day = 2 14 Hour = 14 35 Minute = 35 47 Second = 47 12 First two millisecond digits 3 Millisecond units 2 Weekday = Monday Result: 2024-09-02 14:35:47.123

BCD Validation

The decoder validates each BCD field before attempting to interpret it. Both the high and low nibbles of the full BCD bytes must be decimal digits from 0 to 9.

Valid BCD: 59 Invalid BCD: 5A AF FF

Calendar Validation

BCD-valid bytes do not automatically describe a valid date. For example, February 31 can be represented with valid BCD digits but is not a real calendar date.

The tool therefore separately validates the decoded year, month and day, including leap-year rules.

Leap Year Example

2024-02-29 Valid 2023-02-29 Invalid

The encoder refuses invalid calendar combinations rather than generating an 8-byte value that contains an impossible date.

DATE_AND_TIME vs Newer Siemens Date Types

The tool specifically handles the classic eight-byte S7 DATE_AND_TIME format. Newer Siemens environments can also provide types such as DATE, TIME, TIME_OF_DAY, LDT and DTL that use different binary layouts.

Those types should not be decoded as an eight-byte DATE_AND_TIME value simply because they also represent calendar or clock information.

Siemens DATE_AND_TIME Decoder FAQs

How many bytes does S7 DATE_AND_TIME use?
The classic Siemens S7 DATE_AND_TIME representation uses eight bytes.
Is DATE_AND_TIME stored as Unix time?
No. It stores individual date and time components primarily as packed BCD.
What year range can DATE_AND_TIME represent?
The classic mapping covers years 1990 through 2089.
How does year byte 99 decode?
BCD 99 maps to the year 1999.
How does year byte 00 decode?
BCD 00 maps to the year 2000.
Where are milliseconds stored?
Byte 6 contains the first two decimal millisecond digits and the high nibble of byte 7 contains the final decimal digit.
Where is the weekday stored?
The lower nibble of byte 7 stores a weekday value from 1 through 7.
What does weekday 1 mean?
Weekday value 1 represents Sunday.
Does the tool check impossible dates?
Yes. Month lengths and leap years are checked in addition to the BCD format.
Can I encode a DATE_AND_TIME value?
Yes. Switch to Build 8 Bytes, enter the date, time and milliseconds, and the tool generates the corresponding Siemens DATE_AND_TIME bytes.

Decode Siemens S7 DATE_AND_TIME Values

Convert classic Siemens eight-byte BCD date/time values into readable calendar timestamps or generate valid DATE_AND_TIME bytes from year, month, day, clock, milliseconds and weekday values.

Scroll to Top