Java tutorial
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; import java.util.Locale; public class Main { private static SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ITALIAN); public static GregorianCalendar getCalFromString(String data) { dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ITALIAN); try { Date dateTime = dateFormat.parse(data); GregorianCalendar gregCalendar = new GregorianCalendar(); gregCalendar.setTime(dateTime); return gregCalendar; } catch (ParseException e) { e.printStackTrace(); return null; } } }