Sha256: cb376b32849e37fdae2a9f987c44df21a45dae8d5b0a5b5927bf97a69b30a702

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

package org.embulk.input.s3.utils;

import com.google.common.base.Joiner;
import org.embulk.config.ConfigException;
import org.joda.time.format.DateTimeFormat;

import java.util.Date;
import java.util.List;

public class DateUtils
{
    public static Date parse(final String value, final List<String> supportedFormats)
            throws ConfigException
    {
        for (final String fmt : supportedFormats) {
            try {
                return DateTimeFormat.forPattern(fmt).parseDateTime(value).toDate();
            } catch (final IllegalArgumentException e) {
                // ignorable exception
            }
        }
        throw new ConfigException("Unsupported DateTime value: '" + value + "', supported formats: [" + Joiner.on(",").join(supportedFormats) + "]");
    }

    private DateUtils()
    {
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-input-s3-0.3.5 src/main/java/org/embulk/input/s3/utils/DateUtils.java
embulk-input-s3-0.3.4 src/main/java/org/embulk/input/s3/utils/DateUtils.java