Menu

#8 Java to C# date translation

open
nobody
None
6
2013-07-11
2012-04-02
No

When returning a list of Date elements from Java to C#, the internal long/Int64 value seems to change. The long value in Java of 1480572000000 becomes 5116598731042580000 in C#.

Is this a bug? Is there a work around to the list of Date issue?

Thanks,
Malcolm

Discussion

  • malcolm davis

    malcolm davis - 2012-04-14
    • priority: 5 --> 6
     
  • malcolm davis

    malcolm davis - 2012-04-14

    I may have not explained the problem correctly.

    Is there a data type conversion of Java Date types to C# Date types?

    What does Java Date convert to in C#?

    The C# date type seems to contain an incorrect value when talking to a Hessian server written in Java. The Java Date object shows up incorrectly in C# client.

    Thanks,
    Malcolm

     
  • Arrndt Faulhaber

    Actually, for us it works...

    We send java.util.Date

    and receive DateTime-Objects on the C# side... Actually the date is a special type in the hessian protocol, so the representation in the languages themselves are kind of irrelevant - the types just have to be coded/decoded correctly in the protocol (no need for parsing/casting etc.).

    Maybe you can tell us which types you use on the Java/C# sides respectively, so I may look into it ;)

    Cheers, Arndt

     
  • Addison

    Addison - 2013-07-11

    I meet the same problem, in java I send the data Map<String,Date>
    and the C# client received the data became to HashTable<key,HashTable>
    and in the C# side HashTable value always became to 1601/1/2 ...

     
  • Addison

    Addison - 2013-07-11

    in the java Map the value is a Date ,like this
    Map m = new HashMap();
    m.put("mydate",new Date());
    but the C# side receive the value became to HashTable(“mydate”,HashTable)

     

Log in to post a comment.