Android Date Format getFormatDateString(String format, java.util.Date date)

Here you can find the source of getFormatDateString(String format, java.util.Date date)

Description

get Format Date String

Declaration

public static final String getFormatDateString(String format,
        java.util.Date date) 

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  v  a  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, String pattern)
  2. formatDate(Date date, String pattern, Locale locale)
  3. format(Date d, String dateFormat)
  4. getShortFriendlyDate(Date dt)
  5. getFormatDateString(String format)
  6. getFormatDateTime(String formatString, Date d)
  7. formatDateToString(Date timestamp)
  8. getStringByFormat(Date date, String format)
  9. getStringByFormat(Date date, String format)