据我所知,java.util.Date将日期存储为1970年1月1日00:00的毫秒数...
所以,我已经尝试过以下代码:
public void testDateFormatBehavior()
{
DateFormat dfNoDay = new SimpleDateFormat(
"MMM d H:m:s zzz yyyy"
);
// This one should be correct as IST = GMT+5.30
String expStrDateBegIST1 = "Jan 01 05:30:01 IST 1970";
// Instead, this one seems to do the conversion to
// Jan 01 00:00:00 GMT 1970
String expStrDateBegIST2 = "Jan 01 02:00:01 IST 1970";
String expStrDateBegUTC = "Jan 01 00:00:01 GMT 1970";
String expStrDateBegCET = "Jan 01 01:00:00 CET 1970";
// Should convert to Jan …Run Code Online (Sandbox Code Playgroud)