Computers use binary numbers, strings of ones (1) and zeros (0), to communicate. It is difficult for humans to communicate in binary numbers, so binary numbers must be translated. The translation is done into hexadecimal numbers, a base 16 where the "numbers" used are from zero through the letter F (e.g., 0123456789ABCDEF). Humans can code easier using hexadecimal numbers, and then translate it to binary to ensure the code is executed properly by the machine. The best way to convert dates to hexadecimal is to convert the serial equivalent of the date to the respective hexadecimal numbers.
Convert the date to a decimal numeric format by calculating the days between the requested date with January 1, 1900. For example, days between July 3, 2002 and January 1, 1900 are 37,440 (102 total years x 365 + 210 additional calendar days from January 1 to July 3, 2002).
Convert the decimal number calculated from Step 1 to hexadecimal. Divide your decimal number by 16; if you have a remainder, multiply only the remainder by 16 to get a hex value.
For example, to convert the decimal number 60 to hex, divide 60 by 16 which equals 3.75. Multiple the remainder, 0.75, by 16 which equals 12. The resulting 12 is your decimal value to be converted to hex. Consult the table in Reference 1 for the hex conversion value which is C.
Take the whole result of 3.75, or the 3, and divide that by 16; this equals 0.1875. Multiply this number by 16. The result is 3 decimal and C hex.
Write out the hexadecimal numbers. Once all the hex numbers are found, reverse the order of the hex results to get your hex number. Our calculation of the decimal number 60 is 3C hex.
Open a new Excel spreadsheet, and enter in cell A1 a date in the MM/DD/YYYY format. MM being month, DD being day and YYYY being the year.
Enter the formula "=Dec2Hex(A1)" without the quotes in cell A2. The "Dec2Hex" Excel function converts your date in cell A1 to hexadecimal format.
Compare your hand written version with the Excel version.
About the Author
Mehmet Karakus began writing professionally in 2010. His work focuses on projects, process, finance and product management. He has worked for organizations helping to enhance management to increase efficiency. He has also been published in "PMI Magazine." Karakus received a degree in electrical engineering from Northeastern University.