Descripción
Sintaxis
public abstract class Calendar extends Object implements Serializable, Cloneable, Comparable<Calendar>
Constructores
Campos
- ALL_STYLES
- AM
- AM_PM
- APRIL
- areFieldsSet
- AUGUST
- DATE
- DAY_OF_MONTH
- DAY_OF_WEEK
- DAY_OF_WEEK_IN_MONTH
- DAY_OF_YEAR
- DECEMBER
- DST_OFFSET
- ERA
- FEBRUARY
- FIELD_COUNT
- fields
- FRIDAY
- HOUR
- HOUR_OF_DAY
- isSet
- isTimeSet
- JANUARY
- JULY
- JUNE
- LONG
- LONG_FORMAT
- LONG_STANDALONE
- MARCH
- MAY
- MILLISECOND
- MINUTE
- MONDAY
- MONTH
- NARROW_FORMAT
- NARROW_STANDALONE
- NOVEMBER
- OCTOBER
- PM
- SATURDAY
- SECOND
- SEPTEMBER
- SHORT
- SHORT_FORMAT
- SHORT_STANDALONE
- SUNDAY
- THURSDAY
- time
- TUESDAY
- UNDECIMBER
- WEDNESDAY
- WEEK_OF_MONTH
- WEEK_OF_YEAR
- YEAR
- ZONE_OFFSET
Métodos
- add()
- after()
- before()
- clear()
- clone()
- compareTo()
- complete()
- computeFields()
- computeTime()
- equals()
- get()
- getActualMaximum()
- getActualMinimum()
- getAvailableCalendarTypes()
- getAvailableLocales()
- getCalendarType()
- getDisplayName()
- getDisplayNames()
- getFirstDayOfWeek()
- getGreatestMinimum()
- getInstance()
- getLeastMaximum()
- getMaximum()
- getMinimalDaysInFirstWeek()
- getMinimum()
- getTime()
- getTimeInMillis()
- getTimeZone()
- getWeeksInWeekYear()
- getWeekYear()
- hashCode()
- internalGet()
- isLenient()
- isSet()
- isWeekDateSupported()
- roll()
- set()
- setFirstDayOfWeek()
- setLenient()
- setMinimalDaysInFirstWeek()
- setTime()
- setTimeInMillis()
- setTimeZone()
- setWeekDate()
- toInstant()
- toString()
Ejemplo
Date d = new Date();
Calendar c = new GregorianCalendar();
c.setTime(d);
String dia, mes, annio, hora, minuto, segundo;
dia = Integer.toString(c.get(Calendar.DATE));
mes = Integer.toString(c.get(Calendar.MONTH));
annio = Integer.toString(c.get(Calendar.YEAR));
hora = Integer.toString(c.get(Calendar.HOUR_OF_DAY));
minuto = Integer.toString(c.get(Calendar.MINUTE));
segundo = Integer.toString(c.get(Calendar.SECOND));
System.out.println (hora + ":" + minuto + ":" + segundo + " " + dia + "/" + mes +"/" + annio);
Líneas de Código
Vídeos Java
Disfruta también de nuestros artículos sobre Java en formato vídeo. Aprovecha y suscribete a nuestro canal.