Android Date Trim convertToShortDate(Date date)

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

Description

convert To Short Date

Declaration

public static Date convertToShortDate(Date date) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date convertToShortDate(Date date) {
        if (date == null) {
            return null;
        }/*w ww . j a  va  2  s  .c o m*/

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        return calendar.getTime();
    }
}

Related

  1. convertToShortHour(Date date)
  2. convertToShortMonth(Date date)
  3. convertToShortWeek(Date date)
  4. convertToShortYear(Date date)