How to convert timezone information in C # to timezone information in Java?

I have a system consisting of C # and the end of Java . The C # console interacts with other systems and some mobile devices.

On the C # side, my task, among other things, is to recognize the time zone of timestamps coming from mobile devices and create the corresponding object TimeZoneInfo. It works without a problem.

On the Java side , I have to display the time zone information along with the data sent by the mobile device. I use a class TimeZoneto store time zone information in objects of my domain.

Now the question is how can I create a Java TimeZone object that matches a C # object TimeZoneInfo? AFAIKs in time zones do not have unique identifiers. In addition, the names also differ (for example, in C # : " Central Europe Standard Time", in Java " Central Europe Time"). Even the number of time zones in C # and Java is equal!

+5
source share
2 answers

You know that "time" does not depend on a "time zone", so I will not upset this item :)

"TimeZone" really depends more on your OS than on a programming language.

Android "Time Zone Identifiers" comply with the IANA Olson Database standard:

- .Net timezones "". :

+6

paulsm4, Windows TZDB ( , aka tz, aka zoneinfo) - , Unicode CLDR . , Windows TZDB. ( .)

Windows TZDB , Noda Time,.NET API /. . / Java , Joda Time, , "" Noda Time . , Date Calendar Java.

+5

All Articles