Java Date to String dateToString_yyyyMMddHHmmssSSS(Date date)

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

Description

date To Strinyyyy M Mdd H Hmmss SSS

License

Open Source License

Declaration

public static String dateToString_yyyyMMddHHmmssSSS(Date date) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
    public static final String DATETIME_PATTERN_LONG2 = "yyyyMMddHHmmssSSS";

    public static String dateToString_yyyyMMddHHmmssSSS(Date date) {
        if (date == null) {
            return null;
        }// ww  w.  j av a 2s .  com
        return formatDateTime(date, DATETIME_PATTERN_LONG2);
    }

    public static String formatDateTime(Date d) {
        return formatDateTime(d, DATETIME_PATTERN);
    }

    public static String formatDateTime(Date d, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(d);
    }
}

Related

  1. dateToString(final Date value, final boolean utc)
  2. dateToString(java.util.Date currdate, String strFormat)
  3. dateToString(String date, String format)
  4. dateToString(String str, DateTimeFormatter dateTimeFormatter)
  5. dateToString1(Date date, String formatIn)
  6. DateToStringByformat2(Date date)
  7. dateToStringFecha(Date fecha)
  8. dateToStringFormat(Date dt, String format)
  9. dateToStringShort(Date date)