System Time should be set Hong Kong (UTC+08:00)
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class HKtimeZone {
public static void main(String [] args ) throws ParseException{
String dateString = "1900-01-01 08:00:00.000";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date endDate = df.parse(dateString);
System.out.println(endDate);
}
}
Above piece of code prints:
Mon Jan 01 08:05:43 CST 1900
instead of
Mon Jan 01 08:00:00 CST 1900.
I know the reason/history of it but I want to know is there any know solution to it in Java. I have problem in my project specific to this time so I am not asking it just for fun or testing someone knowledge.
Note : Setting timezone to UTC/GMT make situation more worse.