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

org.echocat.locela.api.java.utils.DateTimeUtils Maven / Gradle / Ivy

Go to download

Java API of a localization framework for an easy and platform independent work.

There is a newer version: 2.0.8
Show newest version
package org.echocat.locela.api.java.utils;

import javax.annotation.Nonnull;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTimeUtils {

    public static final String ISO_PATTERN = "yyyy-MM-dd'T'HH:mm:ssZ";

    @Nonnull
    public static Date parseIsoDate(@Nonnull String asString) throws IllegalArgumentException {
        try {
            return new SimpleDateFormat(ISO_PATTERN).parse(asString);
        } catch (final ParseException e) {
            throw new IllegalArgumentException("Could not parse: " + asString + ", it does not match pattern: " + ISO_PATTERN, e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy