C#-JAVA Compatibility problem of Date type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LandWolf

    C#-JAVA Compatibility problem of Date type

    Hi,
    I have a Web services write in Java and I want to write a client in C#.
    My web services work with Weather prevision. Hence, I set a date and my
    web services return the prevision for that date. When the web service
    return the date, this date is wrong.

    Es:
    Choose date: 24-apr-2006
    Responce of Web service: day: 23-apr-2006, condition: sunny,
    temperature: 28

    The date that Web servis return is always back of a day!!!!!

    How is possible? I think there is some problem of compatibility.. ..
    In wsdl I use the type xsd:datetime

    Please, can someone help me?

    Thanks,
    LandWolf.

  • Bjorn Abelli

    #2
    Re: C#-JAVA Compatibility problem of Date type


    "LandWolf" wrote...
    [color=blue]
    > I have a Web services write in Java and I want to write a client in C#.
    > My web services work with Weather prevision. Hence, I set a date and my
    > web services return the prevision for that date. When the web service
    > return the date, this date is wrong.
    >
    > Es:
    > Choose date: 24-apr-2006
    > Responce of Web service: day: 23-apr-2006, condition: sunny,
    > temperature: 28
    >
    > The date that Web servis return is always back of a day!!!!!
    >
    > How is possible? I think there is some problem of compatibility.. ..
    > In wsdl I use the type xsd:datetime
    >
    > Please, can someone help me?[/color]

    I can at least provide an explanation.

    We have different TimeZones over the world, so an instance of DateTime used
    in two different TimeZones, will yield the *wrong* Date and Time in one of
    them, as the .NET DateTime doesn't take the timezones into consideration.

    In Java, a Date is internally storing the UTC-time, which means that it will
    always be "correct" all over the world; 2006-04-23 23:00 in London *is* the
    same as 2006-04-24 01:00 in Stockholm.

    This means that when you "send a DateTime instance across the border", it
    will simply have the wrong internal date and time...

    Now, I don't know how the Java Webservice is written, where it is located,
    and I don't know how you call it, but one possible solution might be to
    convert your local DateTime in your client into a DateTime instance in
    UTC-time before you call the webservice.


    // Bjorn A


    Comment

    • chanmm

      #3
      Re: C#-JAVA Compatibility problem of Date type

      Try to find some answer here perhaps:


      chanmm

      "LandWolf" <francesco.land olfo@gmail.com> wrote in message
      news:1149240203 .509618.149740@ u72g2000cwu.goo glegroups.com.. .[color=blue]
      > Hi,
      > I have a Web services write in Java and I want to write a client in C#.
      > My web services work with Weather prevision. Hence, I set a date and my
      > web services return the prevision for that date. When the web service
      > return the date, this date is wrong.
      >
      > Es:
      > Choose date: 24-apr-2006
      > Responce of Web service: day: 23-apr-2006, condition: sunny,
      > temperature: 28
      >
      > The date that Web servis return is always back of a day!!!!!
      >
      > How is possible? I think there is some problem of compatibility.. ..
      > In wsdl I use the type xsd:datetime
      >
      > Please, can someone help me?
      >
      > Thanks,
      > LandWolf.
      >[/color]


      Comment

      Working...