Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time zone java : San Antonio, Texas

Hi I am looking to set the timezone for San Antonio, Texas.Can some please tell me how do i set the same in my Java code.

I want it in the format somewhat similar to America/New York

Currently I am using this code

TimeZone.getTimeZone("America/Denver");

But "America/Denver" doesn't seem to be the right timezone for San Antonio, Texas

like image 664
Zaje Avatar asked Oct 13 '10 15:10

Zaje


1 Answers

For San Antonio, you should use TimeZone.getTimeZone("US/Central")

If you really need to use "America/<City>" format, the closest to San Antonio us city is "America/Chicago".

You can use this to get a list of all available specific IDs for US/Central:

String[] values = TimeZone.getAvailableIDs(TimeZone.getTimeZone("US/Central").getRawOffset());

And then, double check here:

http://www.timeanddate.com/time/zones/

like image 87
L. Holanda Avatar answered Sep 27 '22 21:09

L. Holanda