Code example for GregorianCalendar

Methods: setTime

0
 
 
    private GregorianCalendar parse(String o1, DateFormat formatter) {
        try { 
            Date date = formatter.parse(o1);
            GregorianCalendar c = new GregorianCalendar();
            c.setTime(date);
            return c;
        } catch (java.text.ParseException e) {
            return null; 
        } 
    } 
 
 
    @Override 
    public void write(JSONWriter writer, Properties options)
    throws JSONException { 
 
        writer.object();
        writer.key("description"); writer.value("Returns o converted to a date object, you can hint if the day or the month is listed first, or give an ordered list of possible formats using this syntax: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html");
        writer.key("params"); writer.value("o, boolean month_first / format1, format2, ... (all optional)");