Here you can find the source of getCalendarFromISO8601String(final String timestamp, final TimeZone tz)
Parameter | Description |
---|---|
timestamp | a parameter |
public static Calendar getCalendarFromISO8601String(final String timestamp, final TimeZone tz)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Main { /**// w w w. j a v a 2s .c o m * Convert from a ISO8601 style date (YYYY-MM-DDThh:mm:ssZ) string to a * Calendar Object. * * @param timestamp * @return */ public static Calendar getCalendarFromISO8601String(final String timestamp, final TimeZone tz) { final Calendar cal = Calendar.getInstance(tz); final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); try { cal.setTime(df.parse(timestamp)); } catch (final ParseException pe) { pe.printStackTrace(); return null; } return cal; } }