I have some data's like 2014-06-11T22:22:17
which i am matching using regex ([\d-])+T([\d:])+
in two different part by separating date and time like
2014-06-11
and 22:22:17
so i have created two groups
but when i am extracting the data like as below
Date =m.group(1);
it extract only digit "1" in Date String, why is it not extracting the entire group which is 2014-06-11
?
I would like to use LocalDateTime
in your case to get the date and time separately like this:
LocalDateTime dateTime = LocalDateTime.parse("2014-06-11T22:22:17");
LocalDate date = dateTime.toLocalDate(); // 2014-06-11
LocalTime time = dateTime.toLocalTime(); // 22:22:17
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.