Android Date Format toDateTimeString(Date value)

Here you can find the source of toDateTimeString(Date value)

Description

to Date Time String

License

Apache License

Declaration

public static String toDateTimeString(Date value) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static String toDateTimeString(Date value) {
        if (value != null) {
            SimpleDateFormat dateFormat = new SimpleDateFormat(
                    "yyyy-MM-dd HH:mm:ss");
            dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

            return dateFormat.format(value);
        } else {//from   ww w.  j a v a  2  s.  c  o  m
            return "";
        }
    }
}

Related

  1. getFormatYestoday(String format)
  2. getUniversalDateStamp(Date date)
  3. getUtcTimeStringFromDate(Date date)
  4. timestampToISO8601(Date aDate)
  5. toDateString(Date value)
  6. toRelativeDateString(Date value)
  7. toString(Date date, String format)
  8. toString(Date value, String format)
  9. toStringFR(Date date)