5

I am working with timezones in a Java application using JodaTime. I encounter a problem when trying to build a DateTimeZone (JodaTime) object from the id of a java timezone. Joda throws a

 java.lang.IllegalArgumentException: The datetime zone id 'SystemV/HST10' is not recognised

for the folowing list of timezones:

  • SystemV/HST10
  • SystemV/YST9
  • SystemV/YST9YDT
  • SystemV/PST8
  • SystemV/PST8PDT
  • SystemV/MST7
  • SystemV/MST7MDT
  • SystemV/CST6
  • SystemV/CST6CDT
  • SystemV/EST5
  • SystemV/EST5EDT
  • SystemV/AST4
  • SystemV/AST4ADT

What are these timezones used for? Are they relevant to non-programmers? Should an application designed for general uses support these timezones?

Thanks.

sebi
  • 1,791
  • 3
  • 25
  • 43

3 Answers3

4

The SystemV time-zone IDs are old and deprecated. However, you can make Joda-Time understand them by re-compiling the joda-time jar file with the systemv time-zone data file included. See the commented out lines in the systemv data file. (ie. uncomment the lines and rebuild the jar file).

JodaStephen
  • 60,927
  • 15
  • 95
  • 117
  • Please check this [question](http://stackoverflow.com/questions/12606502/exception-while-trying-to-recompile-joda-time-2-1-source) . – Emil Sep 26 '12 at 16:42
3

I'll add this as a new post, as it provides the answers to my question. SystemV timezones were used in an old UNIX OS, that was named, you guessed it, UNIX SYSTEM V. After discussing with my team, we decided that they are of no importance to non-programers and even to programmers nowadays. So we decided not to use them in our application.

Some references about the SystemV timezones:

sebi
  • 1,791
  • 3
  • 25
  • 43
1

You can simply convert java TimeZone to DateTimeZone, using method DateTimeZone#forTimeZone

TimeZone tz = //...  
DateTimeZone dtz = DateTimeZone.forTimeZone(tz);  

Some of this zones can be parsed without "SystemV/"

So you can use

String tzId = "SystemV/MST7MDT";
DateTimeZone tz = DateTimeZone.forID(tzId.replaceAll("SystemV/", ""));  

Also you can make next

TimeZone tz = TimeZone.getTimeZone("SystemV/MST7MDT");
DateTimeZone jodaTz = DateTimeZone.forTimeZone(tz);
Ilya
  • 29,135
  • 19
  • 110
  • 158