mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
bd71f0c586
commit
5b129a1a8f
@ -3,6 +3,8 @@ package org.dromara.hutool.core.date;
|
|||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
public class Issue3798Test {
|
public class Issue3798Test {
|
||||||
@Test
|
@Test
|
||||||
void parseTest() {
|
void parseTest() {
|
||||||
@ -13,6 +15,10 @@ public class Issue3798Test {
|
|||||||
// 伦敦时间(Greenwich Mean Time, GMT)和北京时间(China Standard Time, CST)之间的时差是8小时。北京时间比伦敦时间快8小时
|
// 伦敦时间(Greenwich Mean Time, GMT)和北京时间(China Standard Time, CST)之间的时差是8小时。北京时间比伦敦时间快8小时
|
||||||
final String iso_datetime2 = "2000-01-01T12:00:00+00:00";
|
final String iso_datetime2 = "2000-01-01T12:00:00+00:00";
|
||||||
final DateTime parse2 = DateUtil.parse(iso_datetime2);
|
final DateTime parse2 = DateUtil.parse(iso_datetime2);
|
||||||
|
|
||||||
|
// 默认的,输出的是当地时间,即伦敦时间在北京是几点
|
||||||
Assertions.assertEquals("2000-01-01 20:00:00", parse2.toString());
|
Assertions.assertEquals("2000-01-01 20:00:00", parse2.toString());
|
||||||
|
// 如果想输出伦敦时间,则,需要指定时区
|
||||||
|
Assertions.assertEquals("2000-01-01 12:00:00", parse2.toString(TimeZone.getTimeZone("GMT+00:00")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user