FastDateTimeParser

Ecng.Common

Provides methods to parse and format date and time strings using a fast custom parser.

コンストラクター

FastDateTimeParser
public FastDateTimeParser(string template)
fastDateTimeParser = FastDateTimeParser(template)

Initializes a new instance of the FastDateTimeParser class with the specified format template.

template
The date and time format template.

プロパティ

Template
public string Template { get; }
value = fastDateTimeParser.Template

Gets the date and time format template used for parsing and formatting.

メソッド

Append
private static void Append(StringBuilder builder, int value, int size)
FastDateTimeParser.Append(builder, value, size)

Appends the specified integer value to the StringBuilder with a given size.

builder
The StringBuilder to append to.
value
The integer value to append.
size
The number of digits to include.
Parse
public DateTime Parse(string input)
result = fastDateTimeParser.Parse(input)

Parses the specified input string into a DateTime based on the predefined template.

input
The string input representing the date and time.

戻り値: A DateTime object parsed from the input string.

ParseDto
public DateTimeOffset ParseDto(string input)
result = fastDateTimeParser.ParseDto(input)

Parses the specified input string into a DateTimeOffset based on the predefined template, applying the time zone if specified.

input
The string input representing the date and time with time zone.

戻り値: A DateTimeOffset object parsed from the input string.

ToString
public string ToString(DateTime value)
result = fastDateTimeParser.ToString(value)

Converts the specified DateTime to its string representation based on the predefined template.

value
The DateTime value to format.

戻り値: A string representation of the date and time.

ToString
public override string ToString()
result = fastDateTimeParser.ToString()

Returns a string representation of the tuple, with values separated by commas.

戻り値: A string representing the tuple's values.