All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.restup.bind.converter.StringToDateConverter Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package com.github.restup.bind.converter;

import java.time.ZonedDateTime;
import java.util.Date;
import java.util.function.Function;

public class StringToDateConverter implements Function {

    private final StringToZonedDateTimeConverter converter;

    public StringToDateConverter() {
        this(new StringToZonedDateTimeConverter());
    }

    public StringToDateConverter(StringToZonedDateTimeConverter converter) {
        super();
        this.converter = converter;
    }

    @Override
    public Date apply(String s) {
        ZonedDateTime zdt = converter.apply(s);
        return Date.from(zdt.toInstant());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy