Class NumberDateFormat
This Lucene.Net.Util.NumberFormat parses long into date strings and vice-versa. It
uses the given dateFormat
and locale to parse and format dates, but before, it
converts long to DateTime objects or vice-versa.
Inherited Members
Namespace: Lucene.Net.QueryParsers.Flexible.Standard.Config
Assembly: Lucene.Net.QueryParser.dll
Syntax
public class NumberDateFormat : NumberFormat
Constructors
NumberDateFormat(DateFormat, DateFormat, IFormatProvider?)
Constructs a NumberDateFormat object using the provided dateStyle
,
timeStyle
, and provider
.
Declaration
public NumberDateFormat(DateFormat dateStyle, DateFormat timeStyle, IFormatProvider? provider)
Parameters
Type | Name | Description |
---|---|---|
DateFormat | dateStyle | The date formatting style. For example, SHORT for "M/d/yyyy" in the en-US culture. |
DateFormat | timeStyle | The time formatting style. For example, SHORT for "h:mm tt" in the en-US culture. |
IFormatProvider | provider | An object that supplies culture-specific formatting information. |
NumberDateFormat(DateFormat, IFormatProvider?)
Constructs a NumberDateFormat object using the provided dateStyle
and provider
.
Declaration
public NumberDateFormat(DateFormat dateStyle, IFormatProvider? provider)
Parameters
Type | Name | Description |
---|---|---|
DateFormat | dateStyle | The date formatting style. For example, SHORT for "M/d/yy" in the en-US culture. |
IFormatProvider | provider | An object that supplies culture-specific formatting information. |
NumberDateFormat(string?, IFormatProvider?)
Constructs a NumberDateFormat object using the given dateFormat
and provider
.
Declaration
public NumberDateFormat(string? dateFormat, IFormatProvider? provider)
Parameters
Type | Name | Description |
---|---|---|
string | dateFormat | Date format used to parse and format dates. |
IFormatProvider | provider | An object that supplies culture-specific formatting information. |
Properties
NumericRepresentation
The numeric representation to convert the date into when calling Parse(string) or convert the date from when calling Format(long) overloads.
Declaration
public NumericRepresentation NumericRepresentation { get; set; }
Property Value
Type | Description |
---|---|
NumericRepresentation |
TimeZone
The time zone to convert dates to when using Format(long) or from when using Parse(string).
Declaration
public virtual TimeZoneInfo TimeZone { get; set; }
Property Value
Type | Description |
---|---|
TimeZoneInfo |
Methods
Format(double)
This Lucene.Net.Util.NumberFormat parses long into date strings and vice-versa. It
uses the given dateFormat
and locale to parse and format dates, but before, it
converts long to DateTime objects or vice-versa.
Declaration
public override string Format(double number)
Parameters
Type | Name | Description |
---|---|---|
double | number |
Returns
Type | Description |
---|---|
string |
Overrides
Format(long)
This Lucene.Net.Util.NumberFormat parses long into date strings and vice-versa. It
uses the given dateFormat
and locale to parse and format dates, but before, it
converts long to DateTime objects or vice-versa.
Declaration
public override string Format(long number)
Parameters
Type | Name | Description |
---|---|---|
long | number |
Returns
Type | Description |
---|---|
string |
Overrides
Format(object)
This Lucene.Net.Util.NumberFormat parses long into date strings and vice-versa. It
uses the given dateFormat
and locale to parse and format dates, but before, it
converts long to DateTime objects or vice-versa.
Declaration
public override string Format(object number)
Parameters
Type | Name | Description |
---|---|---|
object | number |
Returns
Type | Description |
---|---|
string |
Overrides
GetDateFormat()
Returns the .NET date format that will be used to Format the date. Note that parsing the date uses ParseExact(string, string, IFormatProvider).
Declaration
public string GetDateFormat()
Returns
Type | Description |
---|---|
string |
GetDateFormat(DateFormat, DateFormat, IFormatProvider?)
Gets a date format string similar to Java's SimpleDateFormat using the specified dateStyle
,
timeStyle
and provider
.
Declaration
public static string GetDateFormat(DateFormat dateStyle, DateFormat timeStyle, IFormatProvider? provider)
Parameters
Type | Name | Description |
---|---|---|
DateFormat | dateStyle | The date formatting style. For example, SHORT for "M/d/yyyy" in the en-US culture. |
DateFormat | timeStyle | The time formatting style. For example, SHORT for "h:mm tt" in the en-US culture. |
IFormatProvider | provider | An object that supplies culture-specific formatting information. If |
Returns
Type | Description |
---|---|
string | A date and time format string with a space separator. |
GetDateFormat(DateFormat, IFormatProvider?)
Gets a date format string similar to Java's SimpleDateFormat using the specified dateStyle
and provider
.
Declaration
public static string GetDateFormat(DateFormat dateStyle, IFormatProvider? provider)
Parameters
Type | Name | Description |
---|---|---|
DateFormat | dateStyle | The date formatting style. For example, SHORT for "M/d/yyyy" in the en-US culture. |
IFormatProvider | provider | An object that supplies culture-specific formatting information. If |
Returns
Type | Description |
---|---|
string | A date format string. |
Parse(string)
This Lucene.Net.Util.NumberFormat parses long into date strings and vice-versa. It
uses the given dateFormat
and locale to parse and format dates, but before, it
converts long to DateTime objects or vice-versa.
Declaration
public override Number Parse(string source)
Parameters
Type | Name | Description |
---|---|---|
string | source |
Returns
Type | Description |
---|---|
Number |
Overrides
SetDateFormat(string)
This Lucene.Net.Util.NumberFormat parses long into date strings and vice-versa. It
uses the given dateFormat
and locale to parse and format dates, but before, it
converts long to DateTime objects or vice-versa.
Declaration
public void SetDateFormat(string dateFormat)
Parameters
Type | Name | Description |
---|---|---|
string | dateFormat |