In this section, you will learn to convert a GMT to CET format. The GMT stands for Greenwich Mean Time and CET stands for Central European Time.
Convert GMT to CET
In this section, you will learn to convert a GMT to CET format. The GMT stands for Greenwich Mean
Time and CET stands for Central European Time.
Description of program:
This example helps you in converting a GMT time to CET 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 cetFormat. Then we have used
getTimeZone() method to get the time of both the zones to be converted.
Central European Time (CET)
Standard Time = GMT+1
Summer Time = GMT+2
|
Output of the program:
C:\unique>javac GMTtoCET.java C:\unique>java GMTtoCET GMT Time: 8/4/07 9:32 AM CET Time: 8/4/07 11:32 AM C:\unique> |