11/27/2024 5:58 AM | |
Joined: 11/13/2024 Last visit: 6/25/2025 Posts: 2 Rating:
|
Yes, here it is expplained, I found: I also found an example, i simply copied it and it works. I took the example from this precious document, in italian: // DATA TYPE DATE_AND_TIME // TDS DateTime Protocol // One 4-byte signed integer that represents the number of days since January 1, 1900 // One 4-byte unsigned integer that represents the number of one three-hundredths of a second (300 counts per second) elapsed since 12 AM that day. // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/786f5b8a-f87d-4980-9070-b9b7274c681d // // Merge next 4 BYTE to DWORD and then convert to DINT #TempDays := DWORD_TO_DINT(IN := "LGF_MergeBytesToDWord"(byte0 := #IN_tdsTelegramArray[#IN_statByteAddressCounter], byte1 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 1], byte2 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 2], byte3 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 3])); // Merge next 4 BYTE to DWORD and then convert to DINT #TempTicks := DWORD_TO_DINT(IN := "LGF_MergeBytesToDWord"(byte0 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 4], byte1 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 5], byte2 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 6], byte3 := #IN_tdsTelegramArray[#IN_statByteAddressCounter + 7])); // Calculate days since 1990-01-01 #TempDate := DINT_TO_DATE(IN := #TempDays - 32872); // Calculate milliseconds since 00:00:00.000 // 0,0033333333333333 ticks per second, 3.33333 ticks per milliseconds #TempTOD := LINT_TO_TOD(IN := (#TempTicks / 300) * 1000 + (#TempTicks MOD 300) * 3); // Convert Date and Time_Of_Day to Date_and_time #OUT_DT_Value := CONCAT_DATE_TOD(IN1 := #TempDate, IN2 := #TempTOD);
|
This contribution was helpful to
1 thankful Users |
Follow us on