FastDateTimeParser
Provides methods to parse and format date and time strings using a fast custom parser.
构造函数
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.
属性
public string Template { get; }
value = fastDateTimeParser.Template
Gets the date and time format template used for parsing and formatting.
方法
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.
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.
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.
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.
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.