<commit_before>package org.rundeck.client.api.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by greg on 5/20/16.
 */

@JsonIgnoreProperties(ignoreUnknown = true)
public class DateInfo {
    public String date;
    public long unixtime;

    public DateInfo(final String date) {
        this.date = date;
    }

    public DateInfo() {
    }

    public Date toDate() throws ParseException {
        return toDate("yyyy-MM-dd'T'HH:mm:ss'Z'");
    }
    public Date toDate(final String format) throws ParseException {
        SimpleDateFormat asdf = new SimpleDateFormat(format, Locale.US);<commit_msg>Format date info using default format or env var DATE_FORMAT<commit_after>package org.rundeck.client.api.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.rundeck.client.util.Env;
import org.rundeck.client.util.Format;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by greg on 5/20/16.
 */

@JsonIgnoreProperties(ignoreUnknown = true)
public class DateInfo {
    public String date;
    public long unixtime;

    public DateInfo(final String date) {
        this.date = date;
    }

    public DateInfo() {
    }

    public Date toDate() throws ParseException {
        return toDate("yyyy-MM-dd'T'HH:mm:ss'Z'");
    }

    /**
     * Format using the default or configured date format
     * @return
     */
    public String format() {
        try {
            return Format.date(toDate(), Env.getString("DATE_FORMAT", "yyyy-MM-ddHH:mm:ssZ"));
        } catch (ParseException e) {
            return "?";
        }
    }

    public Date toDate(final String format) throws ParseException {
        SimpleDateFormat asdf = new SimpleDateFormat(format, Locale.US);
{'fraction_non_alphanumeric': 0.10670103092783505, 'fraction_numerical': 0.005154639175257732, 'mean_word_length': 3.210412147505423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4040615', 'n_tokens_mistral': 604, 'n_tokens_neox': 573, 'n_words': 143}