Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Anyone knows how to store UTC time in 4 bytes?


one sample result got from the software:

0x1E 0xEF 0x1E 0x15

3/25/2011 6:13:50 AM
Posted
Comments
Sergey Alexandrovich Kryukov 24-Aug-11 3:14am    
What software?!
--SA

A common 32bit representation is *nix time, which is the number of seconds since 0000UTC on Jan 1, 1970. This format is supported by the date/time handling routines in most modern languages (i.e. from C on). They include utilities to convert to and from this format. Beware, spreadsheets and databases tend to have their own (sometimes totall crazy) representations of date and time.

Cheers,
Peter
 
Share this answer
 
If you are using .NET, then I would suggest 8 bytes instead. Use the DateTime.ToBinary and DateTime.FromBinary methods, both of which use a long value.
 
Share this answer
 
Who knows what some stupid software can take for time? You need to supply more information on it. Nothing causes so many idiotic software problems as calendar. Take the ridiculous "Problem of the year 2000" along…

However, it looks like calendar time needs at least 8 bytes. See here: http://www.cpearson.com/excel/LocalAndGMTTimes.htm[^].

Then again, idiocy of some programmers dealing with time has no limits. It could be time without date, time with low accuracy or some other kind of purely proprietary foolishness. Anyone can invent one's own representation of time and try to puzzle others. You should ask the authors of that software or find out in documentation.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900