Format date to string in yyyy-MM-dd'T'HH:mm:ss ISO8601 format Without Zone String - Android java.util

Android examples for java.util:Timezone

Description

Format date to string in yyyy-MM-dd'T'HH:mm:ss ISO8601 format Without Zone String

Demo Code

import android.util.Log;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main{
    private static final DateFormat ISO8601_DATE_FORMATTER_TYPEII_WITHOUT_ZONE = new SimpleDateFormat(
            "yyyy-MM-dd'T'HH:mm:ss");
    public static final String getISO8601DateWithoutZoneString(Date date) {
        return ISO8601_DATE_FORMATTER_TYPEII_WITHOUT_ZONE.format(date);
    }/* w ww.  j  ava 2  s . com*/

}

Related Tutorials