Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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.

    The long value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is Lucene.Net.Documents.NumericRepresentation.UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".
    Inheritance
    object
    NumberFormat
    NumberDateFormat
    Inherited Members
    NumberFormat.FormatProvider
    NumberFormat.GetNumberFormat()
    NumberFormat.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    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.

    The long value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is Lucene.Net.Documents.NumericRepresentation.UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".
    Declaration
    public override string Format(double number)
    Parameters
    Type Name Description
    double number
    Returns
    Type Description
    string
    Overrides
    NumberFormat.Format(double)

    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.

    The long value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is Lucene.Net.Documents.NumericRepresentation.UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".
    Declaration
    public override string Format(long number)
    Parameters
    Type Name Description
    long number
    Returns
    Type Description
    string
    Overrides
    NumberFormat.Format(long)

    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.

    The long value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is Lucene.Net.Documents.NumericRepresentation.UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".
    Declaration
    public override string Format(object number)
    Parameters
    Type Name Description
    object number
    Returns
    Type Description
    string
    Overrides
    NumberFormat.Format(object)

    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 null the culture of the current thread will be used.

    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 null the culture of the current thread will be used.

    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.

    The long value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is Lucene.Net.Documents.NumericRepresentation.UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".
    Declaration
    public override Number Parse(string source)
    Parameters
    Type Name Description
    string source
    Returns
    Type Description
    Number
    Overrides
    NumberFormat.Parse(string)

    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.

    The long value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is Lucene.Net.Documents.NumericRepresentation.UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".
    Declaration
    public void SetDateFormat(string dateFormat)
    Parameters
    Type Name Description
    string dateFormat
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.