DateTime Convertion To Binary
Hi All,
I am working on Communication Application between C# and Java.
I want to send DateTime in the Binary Form (As .Net understands) so that it can be read in the C# end with the Method DateTime.FromBinary((int64)date);
How can i convert it into this Format.
Any Help would be Highly Appreciated
Regards,
Aamir
Re: DateTime Convertion To Binary
Hello, how exactly is the date stored as binary, is it a long value or a string representing the date or some other way? I've not got much experience with C# myself so I'm not aware how it reads the date and time from binary.
Also, how do intend to communicate between these two applications? Would it not be clever to use a web service or similar or are you using some other protocol?
Re: DateTime Convertion To Binary
Thx for reply,
I am communicating through TCP (Sockets).C# have Builtin Function to read from binary DateTime.FromBinary(int64value) which takes long value and date.ToBinary() to converts to int64 value.
You can check it on
DateTime.ToBinary Method (System)
and
DateTime.FromBinary Method (System)
Thx ,
Regards,
Aamir
Re: DateTime Convertion To Binary
Everything in a computer is in binary format. Its all bits and bytes. Programs control what those bits and bytes represent.
What is the format/contents of the bytes that the C# program expects? Given a bit by bit layout, you can create the data in the correct format using Java so that the C# program can extract/convert the data to the Date/Time.