04-25-2010 10:14 PM
From a CAN device I have the date and time as a series of seven unsigned bytes (U8) as follows:
Century example 20
Year example 10
Month example 4
Day example 26
Hour example 20 (8:00 PM)
Min example 20
Sec example 1
which would be:
4/26/2010
20:20:1
What is the best approach to convertng these seven values to a date/time format for display purposes only?
Thank you.
Solved! Go to Solution.
04-25-2010 10:30 PM - edited 04-25-2010 10:40 PM
Chuck,
Here's a couple of ways to do it, but sure there are others.
The first for numeric inputs or concatenate to a string with second.
Hope one of these does what you need.
*Edit - added combining or Century & Year
04-25-2010 10:45 PM
Your century/year manipulations are incorrect. The result of 20 and 10 gives you 5130. Maybe its a time machine.
What you need to do is basic math, multiply the century number by 100 and add the year.
04-25-2010 11:01 PM
Raven,
You are correct, that combination is just WRONG.
Thanks for the catch....
I guess it's time to go to bed; I'm not paying attention to what I'm doing.