I want to convert strings like "20000603163334 GST"or "20000603163334 -0300"to UTC. The problem is that the time zones in my lines can be "time zones", I mean, they can be lines like CET, GST, etc. And I do not know how to convert them.
Because of these string time zones, I cannot use Joda Time DateTimeFormat.forPattern("yyyyMMddhhmmss z").withZone(DateTimeZone.UTC);, because according to the documentation: Time zone names ('z') cannot be parsed .
So, I have one question, if you know a method to get around this limitation in Joda Time? I would prefer to use Joda Time, if possible, instead of the standard Java API.
Another in which I thought I could solve this problem with timezone names is using Java SimpleDateFormat. So I am doing something like:
SimpleDateFormat f = new SimpleDateFormat("yyyyMMddhhmmss z");
f.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("UTC")));
Date time = f.parse("20000603163334 GST");
SimpleDateFormatanalyzes String(I donβt care about the problem that there are several time zones with the same name - that this class analyzes it well for me).
The problem is that I do not know how to convert it from UTC. How can i do this?
The fact that I set the time zone f'sto UTC (as in two ways from above) does not help. I hope someone can help me fix this, I read a lot of questions and answers on this topic here in stackoverflow, but have not yet found a solution.
source
share