Zaje Zaje - 1 year ago 82
Java Question

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


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

Answer Source

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: