Convert Calendar value to string value

TypeMethodSummary
StringtoString()Return a string representation of this calendar.

import java.util.Calendar;

public class Main {
  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println("Now: " + now.toString());

  }
}

The output:


Now: java.util.GregorianCalendar[time=1288457176765,areFieldsSet=true,
areAllFieldsSet=true,
lenient=true,
zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",
offset=-28800000,dstSavings=3600000,useDaylight=true,
transitions=185,
lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,
useDaylight=true,startYear=0,
startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,
endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,
minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=9,WEEK_OF_YEAR=44,WEEK_OF_MONTH=5,
DAY_OF_MONTH=30,DAY_OF_YEAR=303,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=5,AM_PM=0,HOUR=9,
HOUR_OF_DAY=9,MINUTE=46,SECOND=16,MILLISECOND=765,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.