io.mstream.trader.commons.test.util.date.DateFormatter Maven / Gradle / Ivy
The newest version!
package io.mstream.trader.commons.test.util.date;
import java.time.format.DateTimeFormatter;
import java.util.function.Function;
public class DateFormatter implements Function {
private final DateTimeFormatter source;
private final DateTimeFormatter target;
public DateFormatter(
DateTimeFormatter source,
DateTimeFormatter target
) {
this.source = source;
this.target = target;
}
@Override
public String apply(String dateText) {
return target.format(source.parse(dateText));
}
}