- java.lang.Object
-
- java.text.Format
-
- java.text.DateFormat
-
- java.text.SimpleDateFormat
-
- javax.mail.internet.MailDateFormat
-
- All Implemented Interfaces:
- Serializable, Cloneable
public class MailDateFormat extends SimpleDateFormat
Formats and parses date specification based on the draft-ietf-drums-msg-fmt-08 dated January 26, 2000. This is a followup spec to RFC822.This class does not take pattern strings. It always formats the date based on the specification below.
3.3 Date and Time Specification
Date and time occur in several header fields of a message. This section specifies the syntax for a full date and time specification. Though folding whitespace is permitted throughout the date-time specification, it is recommended that only a single space be used where FWS is required and no space be used where FWS is optional in the date-time specification; some older implementations may not interpret other occurrences of folding whitespace correctly.
date-time = [ day-of-week "," ] date FWS time [CFWS]
day-of-week = ([FWS] day-name) / obs-day-of-week
day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
date = day month year
year = 4*DIGIT / obs-year
month = (FWS month-name FWS) / obs-month
month-name = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
day = ([FWS] 1*2DIGIT) / obs-day
time = time-of-day FWS zone
time-of-day = hour ":" minute [ ":" second ]
hour = 2DIGIT / obs-hour
minute = 2DIGIT / obs-minute
second = 2DIGIT / obs-second
zone = (( "+" / "-" ) 4DIGIT) / obs-zone
The day is the numeric day of the month. The year is any numeric year in the common era.
The time-of-day specifies the number of hours, minutes, and optionally seconds since midnight of the date indicated.
The date and time-of-day SHOULD express local time.
The zone specifies the offset from Coordinated Universal Time (UTC, formerly referred to as "Greenwich Mean Time") that the date and time-of-day represent. The "+" or "-" indicates whether the time-of-day is ahead of or behind Universal Time. The first two digits indicate the number of hours difference from Universal Time, and the last two digits indicate the number of minutes difference from Universal Time. (Hence, +hhmm means +(hh * 60 + mm) minutes, and -hhmm means -(hh * 60 + mm) minutes). The form "+0000" SHOULD be used to indicate a time zone at Universal Time. Though "-0000" also indicates Universal Time, it is used to indicate that the time was generated on a system that may be in a local time zone other than Universal Time.
A date-time specification MUST be semantically valid. That is, the day-of-the week (if included) MUST be the day implied by the date, the numeric day-of-month MUST be between 1 and the number of days allowed for the specified month (in the specified year), the time-of-day MUST be in the range 00:00:00 through 23:59:60 (the number of seconds allowing for a leap second; see [STD-12]), and the zone MUST be within the range -9959 through +9959.
- Since:
- JavaMail 1.2
- Author:
- Max Spivak
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.text.DateFormat
DateFormat.Field
-
-
Field Summary
-
Fields inherited from class java.text.DateFormat
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
-
-
Constructor Summary
Constructors Constructor and Description MailDateFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description StringBuffer
format(Date date, StringBuffer dateStrBuf, FieldPosition fieldPosition)
Formats the given date in the format specified by draft-ietf-drums-msg-fmt-08 in the current TimeZone.Date
parse(String text, ParsePosition pos)
Parses the given date in the format specified by draft-ietf-drums-msg-fmt-08 in the current TimeZone.void
setCalendar(Calendar newCalendar)
Don't allow setting the calendarvoid
setNumberFormat(NumberFormat newNumberFormat)
Don't allow setting the NumberFormat-
Methods inherited from class java.text.SimpleDateFormat
applyLocalizedPattern, applyPattern, clone, equals, formatToCharacterIterator, get2DigitYearStart, getDateFormatSymbols, hashCode, set2DigitYearStart, setDateFormatSymbols, toLocalizedPattern, toPattern
-
Methods inherited from class java.text.DateFormat
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setLenient, setTimeZone
-
Methods inherited from class java.text.Format
format, parseObject
-
-
-
-
Method Detail
-
format
public StringBuffer format(Date date, StringBuffer dateStrBuf, FieldPosition fieldPosition)
Formats the given date in the format specified by draft-ietf-drums-msg-fmt-08 in the current TimeZone.- Overrides:
format
in classSimpleDateFormat
- Parameters:
date
- the Date objectdateStrBuf
- the formatted stringfieldPosition
- the current field position- Returns:
- StringBuffer the formatted String
- Since:
- JavaMail 1.2
-
parse
public Date parse(String text, ParsePosition pos)
Parses the given date in the format specified by draft-ietf-drums-msg-fmt-08 in the current TimeZone.- Overrides:
parse
in classSimpleDateFormat
- Parameters:
text
- the formatted date to be parsedpos
- the current parse position- Returns:
- Date the parsed date in a Date object
- Since:
- JavaMail 1.2
-
setCalendar
public void setCalendar(Calendar newCalendar)
Don't allow setting the calendar- Overrides:
setCalendar
in classDateFormat
-
setNumberFormat
public void setNumberFormat(NumberFormat newNumberFormat)
Don't allow setting the NumberFormat- Overrides:
setNumberFormat
in classDateFormat
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/mail/internet/MailDateFormat.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.