Android Date Format toString(Date value, String format)

Here you can find the source of toString(Date value, String format)

Description

to String

License

Apache License

Declaration

public static String toString(Date value, String format) 

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 toString(Date value, String format) {
        if (value != null) {
            SimpleDateFormat dateFormat = new SimpleDateFormat(format);
            dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

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

Related

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