Converting from time.h tzname[0] to Java TimeZone

114 views Asked by At

I'm writing a service that converts Windows timezone values from calling _tzname[0] (time.h, C++) into Java timezone using SimpleDateFormat.setTimeZone. I'll be getting these values from a REST service so it will only be a String when I get the values from the external service (which uses_tzname[0]).

Example:

String windowsTimeZoneID = "?"; // External value from _tzname[0] REST service
windowsTimeZoneID = "some converted value"; // I'll need to convert the value
final TimeZone timeZone = TimeZone.getTimeZone(windowsTimeZoneID);

final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM-dd-yykkmm");
DATE_FORMAT.setTimeZone(timeZone);

Note: when the external service calls _tzname[0], they strip out "Standard Time" so if _tzname[0] returned "Eastern Standard Time", the service only returns "Eastern".

Is there a list of possible values that _tzname[0] can have?

Edit: I should mention, I don't have control to change the REST service implementation and what it returns (_tzname[0] from time.h)

0

There are 0 answers