Example usage for android.text.format DateUtils FORMAT_SHOW_DATE

List of usage examples for android.text.format DateUtils FORMAT_SHOW_DATE

Introduction

In this page you can find the example usage for android.text.format DateUtils FORMAT_SHOW_DATE.

Prototype

int FORMAT_SHOW_DATE

To view the source code for android.text.format DateUtils FORMAT_SHOW_DATE.

Click Source Link

Usage

From source file:cgeo.geocaching.cgBase.java

/**
 * Generate a date string according to system-wide settings (locale, date format)
 * such as "20 December" or "20 December 2010". The year will only be included when necessary.
 *
 * @param date/*w w  w.  j a  v a2  s .c  o m*/
 *            milliseconds since the epoch
 * @return the formatted string
 */
public String formatDate(long date) {
    return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE);
}

From source file:cgeo.geocaching.cgBase.java

/**
 * Generate a numeric date and time string according to system-wide settings (locale,
 * date format) such as "7 sept.  12:35".
 *
 * @param context/*from  w  ww. j  a  v a 2s .  c  om*/
 *            a Context
 * @param date
 *            milliseconds since the epoch
 * @return the formatted string
 */
public static String formatShortDateTime(Context context, long date) {
    return DateUtils.formatDateTime(context, date,
            DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL);
}

From source file:cgeo.geocaching.cgBase.java

/**
 * Generate a date string according to system-wide settings (locale, date format)
 * such as "20 December 2010". The year will always be included, making it suitable
 * to generate long-lived log entries.//  w w  w  .ja  v a  2s  . com
 *
 * @param date
 *            milliseconds since the epoch
 * @return the formatted string
 */
public String formatFullDate(long date) {
    return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR);
}

From source file:cgeo.geocaching.cgBase.java

/**
 * Generate a numeric date string according to system-wide settings (locale, date format)
 * such as "10/20/2010"./*  www.  j a  v  a 2 s  . co  m*/
 *
 * @param date
 *            milliseconds since the epoch
 * @return the formatted string
 */
public String formatShortDate(long date) {
    return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NUMERIC_DATE);
}