In this section, you will learn to convert a GMT to CST format.In this section, you will learn to convert a GMT to CST format.
In this section, you will learn to convert a GMT to CST format. The GMT stands for Greenwich Mean
Time and CST stands for Central Standard Time.
Description of program:
This example helps you in converting a GMT time to CST time on the console. The SimpleDateFormat() constructor uses the given pattern and date format symbols. Here we use the date format as gmtFormat which gets converted to cstFormat. Then we have used getTimeZone() method to get the time of both the zones to be converted.
Central Time - USA + Canada
Central Standard Time (CST) = GMT-6
Central Daylight Time (CDT) = GMT-5
Here is the code of program:
Output of the program:
GMT Time: 8/4/07 9:44 AM
CST Time: 8/4/07 4:44 AM