Android Date Format getFormatDateString(String format)

Here you can find the source of getFormatDateString(String format)

Description

get Format Date String

Declaration

public static final String getFormatDateString(String format) 

Method Source Code

//package com.java2s;

public class Main {

    public static final String getFormatDateString(String format) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
                format);//from w w w.  j  a va 2s .  c  o m
        java.util.Date d = new java.util.Date();
        return sdf.format(d);
    }

    public static final String getFormatDateString(String format,
            java.util.Date date) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
                format);
        return sdf.format(date);
    }

    public static final String getFormatDateString(String format, long date) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
                format);
        return sdf.format(new java.util.Date(date));
    }
}

Related

  1. formatDate(Date date)
  2. formatDate(Date date, String pattern)
  3. formatDate(Date date, String pattern, Locale locale)
  4. format(Date d, String dateFormat)
  5. getShortFriendlyDate(Date dt)
  6. getFormatDateString(String format, java.util.Date date)
  7. getFormatDateTime(String formatString, Date d)
  8. formatDateToString(Date timestamp)
  9. getStringByFormat(Date date, String format)