Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

import android.content.Context;

import android.text.format.DateUtils;

public class Main {
    /**
     * Returns a String formatted in the default locale of the device. Looks like "Ddd, Mmm dd, H:MMTT - H:MMTT
     * @param context the {@link android.content.Context} that this is running within.
     * @param start the starting date and time of this entry.
     * @param end the ending date and time of this entry.
     */
    public static String buildTimeEntryDateAndTime(Context context, Calendar start, Calendar end) {
        return DateUtils.formatDateRange(context, start.getTimeInMillis(), end.getTimeInMillis(),
                DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_SHOW_TIME
                        | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_WEEKDAY
                        | DateUtils.FORMAT_NO_YEAR);
    }
}