com.fincatto.documentofiscal.transformers.DFZonedDateTimeTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nfe Show documentation
Show all versions of nfe Show documentation
Biblioteca de comunicacao de nota fiscal eletronica brasileira
package com.fincatto.documentofiscal.transformers;
import org.simpleframework.xml.transform.Transform;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class DFZonedDateTimeTransformer implements Transform {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[XXX]");
@Override
public ZonedDateTime read(final String data) {
return ZonedDateTime.parse(data, DFZonedDateTimeTransformer.FORMATTER);
}
@Override
public String write(final ZonedDateTime data) {
return DFZonedDateTimeTransformer.FORMATTER.format(data);
}
}