-6

I have a String like this "15:30:10". Is there anyway to get TimeZone object from this String?

I received a Time String "HH:MM:SS" from another application in other countries (not same with my country). And I have to show the TimeZone. That string is all I have.

halfer
  • 19,824
  • 17
  • 99
  • 186
gamo
  • 1,549
  • 7
  • 24
  • 36

2 Answers2

1

Is there anyway to get TimeZone object from this String?

No.

The String contains no timezone information, and you cannot extract information that isn't there.

I received a Time String "HH:MM:SS" from another application in other countries (not same with my country). And I have to show the TimeZone. That String is all I have.

Same answer. You can't do it.


Thinking outside the box a little bit ...

If the time string was supposed to represent the time >>now<< in some unknown timezone, then you could calculate the offset from UTC for that timezone. (It just requires some simple arithmetic which is too trivial to mention.)

But that doesn't give you a real TimeZone. For example, you won't be able to tell the difference between the timezones for France and Namibia.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

What is the base timezone of your application? Is there any date associated with this time? If you have date and know the base timezone of your application then it is possible. Otherwise forget it

  • Edited my post. The time that I have been received is can come from many country. – gamo Apr 03 '15 at 02:43
  • Check the user profile you might get the information from there or if the request is coming from web there is to identify the timezone by adding js login on jap or html pages http://stackoverflow.com/questions/3001260/how-to-detect-client-timezone – sandeep verma Apr 03 '15 at 03:08