I am looking for a way to serialize date/time value in a binary file. However, the serialized presentation should be such that I must be able to deserialize it across platforms (Windows, Linux), architecture (64 bit/32 bit), and programming languages (C#, Java, C++). I am wondering if there are any public domain functions that are already available. Any pointer would be appreciated.
Use 64-bit milliseconds since UNIX epoch. Should be good for a while ;-) (
There are lots and lots of standards for dates and times. This webpage describes many of these formats. All of these formats can be serialized and deserialized to binary files. Many programming languages have functions that can import, export, and convert these formats.
If you are looking for a very small representation, then 32-bit or 64-bit seconds since a certain date and time might be a good choice. If you can live with a larger representation then you may want to store the date/time in one of the W3C DTF formats. For example the most detailed date/time looks like 1997-07-16T19:20:30.45+01:00.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With