Java Date Format ISO toStringISO8601(Calendar cal)

Here you can find the source of toStringISO8601(Calendar cal)

Description

to String ISO

License

Open Source License

Declaration

public static String toStringISO8601(Calendar cal) throws ParseException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static String toStringISO8601(Date date, String timeZone) throws ParseException {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//from   www  .ja  v  a 2s.co m
        cal.setTimeZone(TimeZone.getTimeZone(timeZone));
        return javax.xml.bind.DatatypeConverter.printDateTime(cal);
    }

    public static String toStringISO8601(Calendar cal) throws ParseException {
        return javax.xml.bind.DatatypeConverter.printDateTime(cal);
    }
}

Related

  1. toISODate(String format, String value)
  2. toISODateRealTimeFormat(Date iDate)
  3. toISOString(Date date, String format, TimeZone tz)
  4. toIsoTime(Date timestamp)
  5. toIsoTime(Date timestamp)