Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class NodaTime.​Text.​OffsetTimePattern
Assembly: NodaTime
Inheritance: object → OffsetTimePattern
Implemented Interfaces
Represents a pattern for parsing and formatting <see cref="T:NodaTime.OffsetTime" /> values.
Properties
public static
OffsetTimePattern
GeneralIso
Gets an invariant offset time pattern based on ISO-8601 (down to the second), including offset from UTC.
Remarks This corresponds to a custom pattern of "HH':'mm':'sso<G>". It is available as the "G"
standard pattern (even though it is invariant).
public static
OffsetTimePattern
ExtendedIso
Gets an invariant offset time pattern based on ISO-8601 (down to the nanosecond), including offset from UTC.
Remarks This corresponds to a custom pattern of "HH':'mm':'ss;FFFFFFFFFo<G>".
This will round-trip all values, and is available as the "o" standard pattern.
public static
OffsetTimePattern
Rfc3339
Gets an invariant offset time pattern based on RFC 3339 (down to the nanosecond), including offset from UTC
as hours and minutes only.
Remarks The minutes part of the offset is always included, but any sub-minute component
of the offset is lost. An offset of zero is formatted as 'Z', but all of 'Z', '+00:00' and '-00:00' are parsed
the same way. The RFC 3339 meaning of '-00:00' is not supported by Noda Time.
Note that parsing is case-sensitive (so 'T' and 'Z' must be upper case).
This pattern corresponds to a custom pattern of
"HH':'mm':'ss;FFFFFFFFFo<Z+HH:mm>".
public
string
PatternText
Gets the pattern text for this pattern, as supplied on creation.
public
OffsetTime
TemplateValue
Gets the value used as a template for parsing: any field values unspecified
in the pattern are taken from the template.
Methods
public
ParseResult<​OffsetTime>
Parse​(string text)
Parses the given text value according to the rules of this pattern.
Returns The result of parsing, which may be successful or unsuccessful.
text
The text value to parse.
Remarks
This method never throws an exception (barring a bug in Noda Time itself). Even errors such as
the argument being null are wrapped in a parse result.
public
string
Format​(OffsetTime value)
Formats the given offset time as text according to the rules of this pattern.
Returns The offset time formatted according to this pattern.
value
The offset time to format.
AppendFormat​(OffsetTime value,
System.​Text.​StringBuilder builder)
Formats the given value as text according to the rules of this pattern,
appending to the given <see cref="T:System.Text.StringBuilder" /> .
Returns The builder passed in as <paramref name="builder" /> .
value
The value to format.
builder
The <c>StringBuilder</c> to append to.
public static
OffsetTimePattern
Create​(string patternText,
System.​Globalization.​CultureInfo cultureInfo,
OffsetTime templateValue)
Creates a pattern for the given pattern text, culture, and template value.
Returns A pattern for parsing and formatting local times.
patternText
Pattern text to create the pattern for
cultureInfo
The culture to use in the pattern
templateValue
Template value to use for unspecified fields
Remarks
See the user guide for the available pattern text options.
public static
OffsetTimePattern
CreateWithInvariantCulture​(string patternText)
Creates a pattern for the given pattern text in the invariant culture, using the default
template value of midnight January 1st 2000 at an offset of 0.
Returns A pattern for parsing and formatting local times.
patternText
Pattern text to create the pattern for
Remarks
See the user guide for the available pattern text options.
public static
OffsetTimePattern
CreateWithCurrentCulture​(string patternText)
Creates a pattern for the given pattern text in the current culture, using the default
template value of midnight January 1st 2000 at an offset of 0.
Returns A pattern for parsing and formatting local times.
patternText
Pattern text to create the pattern for
Remarks
See the user guide for the available pattern text options. Note that the current culture
is captured at the time this method is called - it is not captured at the point of parsing
or formatting values.
public
OffsetTimePattern
WithPatternText​(string patternText)
Creates a pattern for the same original localization information as this pattern, but with the specified
pattern text.
Returns A new pattern with the given pattern text.
patternText
The pattern text to use in the new pattern.
public
OffsetTimePattern
WithCulture​(System.​Globalization.​CultureInfo cultureInfo)
Creates a pattern for the same original pattern text as this pattern, but with the specified
culture.
Returns A new pattern with the given culture.
cultureInfo
The culture to use in the new pattern.
public
OffsetTimePattern
WithTemplateValue​(OffsetTime newTemplateValue)
Creates a pattern for the same original pattern text and culture as this pattern, but with
the specified template value.
Returns A new pattern with the given template value.
newTemplateValue
The template value to use in the new pattern.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object