Android Date to String Convert dateTimeToString(Date date)

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

Description

date Time To String

License

Apache License

Declaration

public static String dateTimeToString(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static SimpleDateFormat formatter = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");

    public static String dateTimeToString(Date date) {
        if (date != null) {
            return (formatter.format(date));
        } else// w  w  w .  java 2 s .  c o  m
            return "";
    }
}

Related

  1. convertToDateStamp(Date date)
  2. dateToIsoDateString(@NotNull Date date)
  3. dateToIsoDateString(@Nullable Date date, @NotNull DateFallback fallback)
  4. formatDate(Date date, String format)
  5. formatDate(String format, Date date)