<commit_before>package br.com.sailboat.canoe.helper;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.format.DateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import br.com.sailboat.canoe.R;

public class DateHelper {

    private static final String DATABASE_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static Calendar parseStringWithDatabaseFormatToCalendar(String date) throws ParseException {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(DATABASE_DATE_TIME_FORMAT);
        calendar.setTime(sdf.parse(date));

        return calendar;
    }

    public static String parseCalendarWithDatabaseFormatToString(Calendar calendar) {
        return new SimpleDateFormat(DATABASE_DATE_TIME_FORMAT).format(calendar.getTime());
    }

    public static String formatTimeWithAndroidFormat(Context ctx, Calendar calendar) {<commit_msg>Add helper method to DateHelper<commit_after>package br.com.sailboat.canoe.helper;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.format.DateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import br.com.sailboat.canoe.R;

public class DateHelper {

    private static final String DATABASE_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static Calendar parseStringWithDatabaseFormatToCalendar(String date) throws ParseException {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(DATABASE_DATE_TIME_FORMAT);
        calendar.setTime(sdf.parse(date));

        return calendar;
    }

    public static String parseStringWithDatabaseFormatToSimpleDate(Context ctx, String date) throws ParseException {
        Calendar calendar = parseStringWithDatabaseFormatToCalendar(date);
        return getShortDate(ctx, calendar);
    }

    public static String parseCalendarWithDatabaseFormatToString(Calendar calendar) {
        return new SimpleDateFormat(DATABASE_DATE_TIME_FORMAT).format(calendar.getTime());
    }

    public static String formatTimeWithAndroidFormat(Context ctx, Calendar calendar) {
{'fraction_non_alphanumeric': 0.07631230701367446, 'fraction_numerical': 0.0, 'mean_word_length': 4.90625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2652527', 'n_tokens_mistral': 623, 'n_tokens_neox': 594, 'n_words': 135}