forked from Fascinated/Bat
23 lines
543 B
Java
23 lines
543 B
Java
package cc.fascinated.bat.common;
|
|
|
|
import lombok.experimental.UtilityClass;
|
|
|
|
import java.time.Instant;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.Date;
|
|
|
|
@UtilityClass
|
|
public class DateUtils {
|
|
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ISO_INSTANT;
|
|
|
|
/**
|
|
* Gets the date from a string.
|
|
*
|
|
* @param date The date string.
|
|
* @return The date.
|
|
*/
|
|
public static Date getDateFromString(String date) {
|
|
return Date.from(Instant.from(FORMATTER.parse(date)));
|
|
}
|
|
}
|