mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add comment for test
This commit is contained in:
@@ -692,8 +692,10 @@ public class DateUtilTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseCSTTest() {
|
public void parseCSTTest() {
|
||||||
String dateStr = "Wed Sep 16 11:26:23 CST 2009";
|
String dateStr = "Wed Sep 16 11:26:23 CST 2009";
|
||||||
|
Console.log(TimeZone.getDefault().getDisplayName());
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(DatePattern.JDK_DATETIME_PATTERN, Locale.US);
|
SimpleDateFormat sdf = new SimpleDateFormat(DatePattern.JDK_DATETIME_PATTERN, Locale.US);
|
||||||
|
// Asia/Shanghai是以地区命名的地区标准时,在中国叫CST,因此如果解析CST时不使用"Asia/Shanghai"而使用"GMT+08:00",会导致相差一个小时
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
||||||
final DateTime parse = DateUtil.parse(dateStr, sdf);
|
final DateTime parse = DateUtil.parse(dateStr, sdf);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user