mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix comment
This commit is contained in:
@@ -17,9 +17,13 @@ public class RegexDateParserTest {
|
||||
|
||||
@Test
|
||||
void parseMonthFirstTest() {
|
||||
// May 8, 2009 5:57:51 PM
|
||||
final RegexDateParser parser = RegexDateParser.of("(?<month>\\w+)\\W+(?<day>\\d{1,2})(?:th)?\\W+(?<year>\\d{2,4}) ");
|
||||
final Date parse = parser.parse("May 8, 2009");
|
||||
Assertions.assertEquals("2009-05-08", DateUtil.date(parse).toDateStr());
|
||||
// May 8, 2009 5:57:51
|
||||
final RegexDateParser parser = RegexDateParser.of("(?<month>\\w+)\\W+(?<day>\\d{1,2})(?:th)?\\W+(?<year>\\d{2,4})(\\s(?<hour>\\d{1,2}):(?<minute>\\d{1,2}):(?<second>\\d{1,2}))?");
|
||||
|
||||
final Date parse = parser.parse("May 8, 2009 5:57:51");
|
||||
Assertions.assertEquals("2009-05-08 05:57:51", DateUtil.date(parse).toString());
|
||||
|
||||
final Date parse2 = parser.parse("May 8, 2009");
|
||||
Assertions.assertEquals("2009-05-08 00:00:00", DateUtil.date(parse2).toString());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user