Skip to main content

Kollmorgen Support Network

Decoding the Date & Time Data Types | 06 Feb 2015 | |

Decoding the Date & Time Data Types

This article refers to G&L PiC application note document AN000007 and describes how to decode  the date and time data types.

A date and time  is stored in memory as a 4 byte value. The following shows an example of how the data is stored.

Example:  Date & Time value:  1995-02-05-06:23:33

475,817,441    (decimal) = 11100010010000110010111100001 (binary)

 

111                  0001                00100              00110              010111            100001

Year                Month             Day                 Hour                Min                 Sec

 

Year                0000 0111

                        0011 1111 AND

                        0000 0111 =  7 +1988 = 1995

 

Month             0000 0001

                        0000 1111 AND

                        0000 0001 = 1 + 1 = 2 (February)

 

Day                 0000 0100

                        0001 1111 AND

                        0000 0100 = 4 + 1 = 5

 

Hour               0000 0110

                        0001 1111 AND

                        0000 0110 = 6

 

Minute            0001 0111

                        0011 1111 AND

                        0001 0111 =  23

 

Second            0010 0001

                        0011 1111 AND

                        0010 0001 = 33

About this Article

Randy Bauer