
io.github.honhimw.ms.support.DateTimeUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of meilisearch-rest-client
Show all versions of meilisearch-rest-client
Reactive meilisearch rest client powered by reactor-netty-http.
package io.github.honhimw.ms.support;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
/**
* @author hon_him
* @since 2022-05-31
*/
@SuppressWarnings("unused")
public class DateTimeUtils {
public static final String RFC_3339 = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
public static final DateTimeFormatter RFC_3339_FORMATTER = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd")
.appendLiteral('T')
.appendPattern("HH:mm:ss")
.appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true)
.appendLiteral('Z')
.toFormatter();
public static String format(LocalDateTime time) {
return time.format(RFC_3339_FORMATTER);
}
public static LocalDateTime parse(String time) {
return LocalDateTime.parse(time, RFC_3339_FORMATTER);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy