Java Time to String timeToString(Calendar date)

Here you can find the source of timeToString(Calendar date)

Description

time To String

License

Apache License

Declaration

public static String timeToString(Calendar date) 

Method Source Code


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

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static final DateFormat FORMAT_DATE = new SimpleDateFormat("dd/MM/yyyy");
    public static final DateFormat FORMAT_TIME = new SimpleDateFormat("HH:mm");

    public static String timeToString(Calendar date) {
        return dateToString(date, FORMAT_TIME);
    }/*from www  . j  a va2s  . co  m*/

    public static String dateToString(Calendar date) {
        return dateToString(date, FORMAT_DATE);
    }

    public static String dateToString(Calendar date, DateFormat format) {
        if (date == null)
            return null;
        return format.format(date.getTime());
    }
}

Related

  1. timeToDeparture(String startTime)
  2. timeToFullString(long time)
  3. timeToFullString(long time, boolean longNames)
  4. timeToStr(int time)
  5. timeToStr(String time)
  6. timeToString(Date d, String tzString)
  7. timeToString(Date date)
  8. timeToString(double d)
  9. timeToString(double time, boolean longNames)