Java Hour Format formatToSec(Date date)

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

Description

format To Sec

License

Apache License

Declaration

public static String formatToSec(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 formatToSec(Date date) {
        return format(date, "yyyyMMdd_HHmmss");
    }/* ww w  . ja  va 2s  .  co  m*/

    public static String format(Date date, String format) {
        String dateString = null;
        if (null != date) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
            dateString = simpleDateFormat.format(date);
        }

        return dateString;
    }
}

Related

  1. formatTime_(String time)
  2. formatTime_1(long time_value)
  3. formatTime_2(long time_value, long frame_rate)
  4. formatToHour(Date date)
  5. formatToOpenMrsDate(Date date)
  6. formatToString(Date date)
  7. formatUIDate(Calendar calendar)
  8. formatUnixFileListing(final Date d)
  9. formatUnsignedVersion(String ver)