format Date to string in yyyy-MM-dd'T'HH:mm:ss.SSS format - Android java.util

Android examples for java.util:Date Format

Description

format Date to string in yyyy-MM-dd'T'HH:mm:ss.SSS format

Demo Code

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

public class Main{

    private static final SimpleDateFormat sdf = new SimpleDateFormat(
            "yyyy-MM-dd'T'HH:mm:ss.SSS");
    /**//w  w w .jav a  2 s.  c  o  m
     * 
     * @param date
     * @return
     */
    public static String formatDate(Date date) {
        return sdf.format(date);
    }

}

Related Tutorials