Class FastDateTimeParser
Provides methods to parse and format date and time strings using a fast custom parser.
public class FastDateTimeParser
- Inheritance
-
FastDateTimeParser
- Inherited Members
- Extension Methods
Constructors
FastDateTimeParser(string)
Initializes a new instance of the FastDateTimeParser class with the specified format template.
public FastDateTimeParser(string template)
Parameters
template
stringThe date and time format template.
Exceptions
- ArgumentNullException
Thrown when the template is null or empty.
Properties
Template
Gets the date and time format template used for parsing and formatting.
public string Template { get; }
Property Value
Methods
Parse(string)
Parses the specified input string into a DateTime based on the predefined template.
public DateTime Parse(string input)
Parameters
input
stringThe string input representing the date and time.
Returns
Exceptions
- InvalidCastException
Thrown when the input cannot be parsed into a valid DateTime.
ParseDto(string)
Parses the specified input string into a DateTimeOffset based on the predefined template, applying the time zone if specified.
public DateTimeOffset ParseDto(string input)
Parameters
input
stringThe string input representing the date and time with time zone.
Returns
- DateTimeOffset
A DateTimeOffset object parsed from the input string.
ToString()
public override string ToString()
Returns
ToString(DateTime)
Converts the specified DateTime to its string representation based on the predefined template.
public string ToString(DateTime value)
Parameters
Returns
- string
A string representation of the date and time.