共用方式為


DateTimeFormatterBuilder Class

Definition

Builder to create date-time formatters.

[Android.Runtime.Register("java/time/format/DateTimeFormatterBuilder", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class DateTimeFormatterBuilder : Java.Lang.Object
[<Android.Runtime.Register("java/time/format/DateTimeFormatterBuilder", ApiSince=26, DoNotGenerateAcw=true)>]
type DateTimeFormatterBuilder = class
    inherit Object
Inheritance
DateTimeFormatterBuilder
Attributes

Remarks

Builder to create date-time formatters.

This allows a DateTimeFormatter to be created. All date-time formatters are created ultimately using this builder.

The basic elements of date-time can all be added: <ul> <li>Value - a numeric value</li> <li>Fraction - a fractional value including the decimal place. Always use this when outputting fractions to ensure that the fraction is parsed correctly</li> <li>Text - the textual equivalent for the value</li> <li>OffsetId/Offset - the ZoneOffset zone offset</li> <li>ZoneId - the ZoneId time-zone id</li> <li>ZoneText - the name of the time-zone</li> <li>ChronologyId - the Chronology chronology id</li> <li>ChronologyText - the name of the chronology</li> <li>Literal - a text literal</li> <li>Nested and Optional - formats can be nested or made optional</li> </ul> In addition, any of the elements may be decorated by padding, either with spaces or any other character.

Finally, a shorthand pattern, mostly compatible with java.text.SimpleDateFormat SimpleDateFormat can be used, see #appendPattern(String). In practice, this simply parses the pattern and calls other methods on the builder.

Added in 1.8.

Java documentation for java.time.format.DateTimeFormatterBuilder.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

DateTimeFormatterBuilder()

Constructs a new instance of the builder.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Append(DateTimeFormatter)

Appends all the elements of a formatter to the builder.

AppendChronologyId()

Appends the chronology ID, such as 'ISO' or 'ThaiBuddhist', to the formatter.

AppendChronologyText(TextStyle)

Appends the chronology name to the formatter.

AppendFraction(ITemporalField, Int32, Int32, Boolean)
AppendGenericZoneText(TextStyle, ICollection<ZoneId>)
AppendGenericZoneText(TextStyle)
AppendInstant()

Appends an instant using ISO-8601 to the formatter, formatting fractional digits in groups of three.

AppendInstant(Int32)

Appends an instant using ISO-8601 to the formatter with control over the number of fractional digits.

AppendLiteral(Char)

Appends a character literal to the formatter.

AppendLiteral(String)

Appends a string literal to the formatter.

AppendLocalized(FormatStyle, FormatStyle)

Appends a localized date-time pattern to the formatter.

AppendLocalizedOffset(TextStyle)

Appends the localized zone offset, such as 'GMT+01:00', to the formatter.

AppendOffset(String, String)

Appends the zone offset, such as '+01:00', to the formatter.

AppendOffsetId()

Appends the zone offset, such as '+01:00', to the formatter.

AppendOptional(DateTimeFormatter)

Appends a formatter to the builder which will optionally format/parse.

AppendPattern(String)

Appends the elements defined by the specified pattern to the builder.

AppendText(ITemporalField, IDictionary<Long,String>)
AppendText(ITemporalField, TextStyle)
AppendText(ITemporalField)
AppendValue(ITemporalField, Int32, Int32, SignStyle)
AppendValue(ITemporalField, Int32)
AppendValue(ITemporalField)
AppendValueReduced(ITemporalField, Int32, Int32, IChronoLocalDate)
AppendValueReduced(ITemporalField, Int32, Int32, Int32)
AppendZoneId()

Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to the formatter.

AppendZoneOrOffsetId()

Appends the time-zone ID, such as 'Europe/Paris' or '+02:00', to the formatter, using the best available zone ID.

AppendZoneRegionId()

Appends the time-zone region ID, such as 'Europe/Paris', to the formatter, rejecting the zone ID if it is a ZoneOffset.

AppendZoneText(TextStyle, ICollection<ZoneId>)
AppendZoneText(TextStyle)

Appends the time-zone name, such as 'British Summer Time', to the formatter.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetLocalizedDateTimePattern(FormatStyle, FormatStyle, IChronology, Locale)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OptionalEnd()

Ends an optional section.

OptionalStart()

Mark the start of an optional section.

PadNext(Int32, Char)

Causes the next added printer/parser to pad to a fixed width.

PadNext(Int32)

Causes the next added printer/parser to pad to a fixed width using a space.

ParseCaseInsensitive()

Changes the parse style to be case insensitive for the remainder of the formatter.

ParseCaseSensitive()

Changes the parse style to be case sensitive for the remainder of the formatter.

ParseDefaulting(ITemporalField, Int64)
ParseLenient()

Changes the parse style to be lenient for the remainder of the formatter.

ParseStrict()

Changes the parse style to be strict for the remainder of the formatter.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToFormatter()

Completes this builder by creating the DateTimeFormatter using the default locale.

ToFormatter(Locale)

Completes this builder by creating the DateTimeFormatter using the specified locale.

ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to