Java Date to Time getTime(Date date)

Here you can find the source of getTime(Date date)

Description

get Time

License

Apache License

Declaration

public static String getTime(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getTime(Date date) {
        SimpleDateFormat formatter_f = new SimpleDateFormat("yyyy-MM-dd");
        String str = formatter_f.format(date);
        return str;
    }/*from  w  ww.j  a  v a 2 s. c o m*/

    public static String format(Date aTs_Datetime) {
        return format(aTs_Datetime, "yyyy-MM-dd");
    }

    public static String format(Date aTs_Datetime, String as_Pattern) {
        if (aTs_Datetime == null || as_Pattern == null)
            return null;

        SimpleDateFormat dateFromat = new SimpleDateFormat();
        dateFromat.applyPattern(as_Pattern);

        return dateFromat.format(aTs_Datetime);
    }
}

Related

  1. extractTimeFromDate(Date date)
  2. getFriendlyTime(Date dateTime)
  3. getFriendlyTimeString(Date date)
  4. getMediumDateString(Date date, boolean includeTime)
  5. getMSDateTimeString(Date date)
  6. getTime(Date date)
  7. getTime(Date date)
  8. getTime(Date date)
  9. getTime(Date date)