Here you can find the source of parseCalendarString(String dateTimeString)
Parameter | Description |
---|---|
dateTimeString | in format 2012-10-15T08:17:00 |
public static Calendar parseCalendarString(String dateTimeString)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { /**/*ww w. java2s .c o m*/ *Converts a dateTimeString and makes a Calendar object * @param dateTimeString in format 2012-10-15T08:17:00 * @return Calendar object * */ public static Calendar parseCalendarString(String dateTimeString) { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss"); Date date = null; try { date = dateFormat.parse(dateTimeString); } catch (ParseException e) { e.printStackTrace(); } Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("Europe/Stockholm")); cal.setTime(date); return cal; } }