java.lang.Object
java.util.Calendar
java.util.GregorianCalendar
- All Implemented Interfaces:
- Serializable, Cloneable, Comparable<Calendar>
- See Also:
- Top Examples, Source Code,
setGregorianChange() , TimeZone
public static final int AD - See Also:
Calendar.ERA
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[191]Create a Calendar with specific date By Anonymous on 2005/09/14 21:24:15 Rate
Calendar calAD = java.util.GregorianCalendar.getInstance ( ) ; calAD.set ( 1999, 1, 23 ) ; System.out.println ( calAD.getTime ( ) ) ;
public void add(int field,
int amount) - See Also:
Calendar.set(int,int) , Calendar.roll(int,int) , IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final int BC - See Also:
Calendar.ERA
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object clone() - See Also:
Cloneable , Calendar
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void computeFields() - See Also:
Calendar.complete()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void computeTime() - See Also:
Calendar.computeFields() , Calendar.complete() , IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean equals(Object obj) - See Also:
Calendar.compareTo(Calendar)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getActualMaximum(int field) - See Also:
getActualMinimum(int) , getLeastMaximum(int) , getGreatestMinimum(int) , getMaximum(int) , getMinimum(int) , Calendar, getTimeZone , getMinimalDaysInFirstWeek , getFirstDayOfWeek
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getActualMinimum(int field) - See Also:
getActualMaximum(int) , getLeastMaximum(int) , getGreatestMinimum(int) , getMaximum(int) , getMinimum(int) , Calendar, getTimeZone , getMinimalDaysInFirstWeek , getFirstDayOfWeek
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getGreatestMinimum(int field) - See Also:
getActualMaximum(int) , getActualMinimum(int) , getLeastMaximum(int) , getMaximum(int) , getMinimum(int) , Calendar, getTimeZone , getMinimalDaysInFirstWeek , getFirstDayOfWeek
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public final Date getGregorianChange() - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getLeastMaximum(int field) - See Also:
getActualMaximum(int) , getActualMinimum(int) , getGreatestMinimum(int) , getMaximum(int) , getMinimum(int) , Calendar, getTimeZone , getMinimalDaysInFirstWeek , getFirstDayOfWeek
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getMaximum(int field) - See Also:
getActualMaximum(int) , getActualMinimum(int) , getLeastMaximum(int) , getGreatestMinimum(int) , getMinimum(int) , Calendar, getTimeZone , getMinimalDaysInFirstWeek , getFirstDayOfWeek , get
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getMinimum(int field) - See Also:
getActualMaximum(int) , getActualMinimum(int) , getLeastMaximum(int) , getGreatestMinimum(int) , getMaximum(int) , Calendar, getTimeZone , getMinimalDaysInFirstWeek , getFirstDayOfWeek , get
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TimeZone getTimeZone() - See Also:
- Calendar
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public GregorianCalendar() - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[46]Use Date & Time operation of calendar class By Anonymous on 2003/11/21 12:19:43 Rate
// The `calendar' class contains operations for getting // the day and date from a `Date' object. GregorianCalendar calendar = new GregorianCalendar ( ) ; // The `setTime' operation sets the time to that contained in the // the specified date object. As a new date object by default // contains the current date and time, the effect of the line // below is to initialize the Calendar obejct to the current // date and time. calendar.setTime ( new Date ( ) ) ; // ( Note that by convention in Java programming, constants // are given names in capital letters ) . This is not // compulsory, but all professional Java programmers do it int hour = calendar.get ( calendar.HOUR_OF_DAY ) ; int minute = calendar.get ( calendar.MINUTE ) ; int dayOfWeek = calendar.get ( calendar.DAY_OF_WEEK ) ; int dayOfMonth = calendar.get ( calendar.DAY_OF_MONTH ) ; int month = calendar.get ( calendar.MONTH ) ; [1242]Classe que demonstra as funcionalidades de GregorianCalendar e SimpleDateFormat By Anonymous on 2005/01/04 18:42:47 Rate
public class Demonstra { public static void main ( String args [ ] ) { GregorianCalendar calendario = new GregorianCalendar ( ) ; SimpleDateFormat data = new SimpleDateFormat ( "dd/MM/yyyy" ) ; SimpleDateFormat hora = new SimpleDateFormat ( "HH:mm" ) ; System.out.println ( "Informa????o completa " + calendario.getTime ( ) ) ; System.out.println ( "Data " + data.format ( calendario.getTime ( ) ) ; System.out.println ( "Hora " + hora.format ( calendario.getTime ( ) ) ; } } [1407]_ By aaa on 2005/04/30 21:00:40 Rate
// The `calendar' class contains operations for getting // the day and date from a `Date' object. GregorianCalendar calendar = new GregorianCalendar ( ) ; // The `setTime' operation sets the time to that contained in the // the specified date object. As a new date object by default // contains the current date and time, the effect of the line // below is to initialize the Calendar obejct to the current // date and time. calendar.setTime ( new Date ( ) ) ; // ( Note that by convention in Java programming, constants // are given names in capital letters ) . This is not // compulsory, but all professional Java programmers do it int hour = calendar.get ( calendar.HOUR_OF_DAY ) ; int minute = calendar.get ( calendar.MINUTE ) ; int dayOfWeek = calendar.get ( calendar.DAY_OF_WEEK ) ; int dayOfMonth = calendar.get ( calendar.DAY_OF_MONTH ) ; int month = calendar.get ( calendar.MONTH ) ;
public GregorianCalendar(int year,
int month,
int dayOfMonth) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public GregorianCalendar(int year,
int month,
int dayOfMonth,
int hourOfDay,
int minute) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public GregorianCalendar(int year,
int month,
int dayOfMonth,
int hourOfDay,
int minute,
int second) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public GregorianCalendar(Locale aLocale) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public GregorianCalendar(TimeZone zone) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public GregorianCalendar(TimeZone zone,
Locale aLocale) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int hashCode() - See Also:
Hashtable , Object.equals(java.lang.Object) , Calendar
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isLeapYear(int year) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[878]Check Leap year By Anonymous on 2005/09/29 07:18:21 Rate
x = isLeapYear ( year ) ;
public void roll(int field,
boolean up) - See Also:
Calendar.set(int,int) , add(int,int) , IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1096]Short DateFormat By Anonymous on 2004/11/04 12:40:45 Rate
Calendar expires = new GregorianCalendar ( ) ; DateFormat df = DateFormat.getDateInstance ( DateFormat.SHORT ) ; expires.setTime ( df.parse ( "11/6/2004" ) ) ; Calendar now = new GregorianCalendar ( ) ; now.setTime ( new Date ( ) ) ; now.roll ( Calendar.DAY_OF_YEAR, 3 ) ; if ( expires.before ( now ) ) System.out.println ( "Hit it" ) ;
public void roll(int field,
int amount) - See Also:
Calendar.set(int,int) , add(int,int) , roll(int,boolean) , IllegalArgumentException, Calendar.complete()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setGregorianChange(Date date) - Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[2016]setGregorianChange doesn't seem to work By JohnRichardHines { at } Yahoo { dot } com on 2011/06/28 13:10:47 Rate
//jdk 1.6_26 and jdk 1.5.9 import java.text.DateFormat; import java.util.*; public class SetGregorianChangeDate { public static void main ( String [ ] args ) { DateFormat df = DateFormat.getDateInstance ( ) ; df.setTimeZone ( TimeZone.getTimeZone ( "GMT" ) ) ; GregorianCalendar gc = new GregorianCalendar ( TimeZone.getTimeZone ( "GMT" ) ) ; System.out.println ( "Get default change date in GMT:" + df.format ( gc.getGregorianChange ( ) .getTime ( ) ) ) ; System.out.println ( "Get day before default change date in GMT ( Expect 11 day gap Oct 4, 1582 ) :" + df.format ( gc.getGregorianChange ( ) .getTime ( ) - 24*60*60*1000 ) ) ; gc = new GregorianCalendar ( TimeZone.getTimeZone ( "GMT" ) ) ; gc.set ( 1752, 9 - 1 , 14, 0, 0, 0 ) ; gc.setGregorianChange ( gc.getTime ( ) ) ; System.out.println ( "Get new change date in GMT:" + df.format ( gc.getGregorianChange ( ) ) ) ; System.out.println ( "Get new day before default change date in GMT ( Expect 12 day gap Sep 2, 1752 ) :" + df.format ( gc.getGregorianChange ( ) .getTime ( ) - 24*60*60*1000 ) ) ; } } Get default change date in GMT:Oct 15, 1582 Get day before default change date in GMT ( Expect 11 day gap Oct 4, 1582 ) :Oct 4, 1582 Get new change date in GMT:Sep 14, 1752 Get new day before default change date in GMT ( Expect 12 day gap Sep 2, 1752 ) :Sep 13, 1752 I see the expected 11 day gap for the default time. But, when I try to set the change date to the English change date, I don't see the expected 12 day gap. Can't see what I'm doing wrong. Any advice?
public void setTimeZone(TimeZone zone) - See Also:
- Calendar
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
| Popular Tags |