Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class NumberDateFormat

    This Lucene.Net.Util.NumberFormat parses System.Int64 into date strings and vice-versa. It uses the given dateFormat and System.Globalization.CultureInfo to parse and format dates, but before, it converts System.Int64 to System.DateTime objects or vice-versa.

    The System.Int64 value the dates are parsed into and out of is specified by changing NumericRepresentation. The default value is UNIX_TIME_MILLISECONDS, which is the number of milliseconds since January 1, 1970 0:00:00 UTC, also known as the "epoch".

    Inheritance
    System.Object
    Lucene.Net.Util.NumberFormat
    NumberDateFormat
    Inherited Members
    Lucene.Net.Util.NumberFormat.FormatProvider
    Lucene.Net.Util.NumberFormat.GetNumberFormat()
    Lucene.Net.Util.NumberFormat.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.QueryParsers.Flexible.Standard.Config
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class NumberDateFormat : NumberFormat

    Constructors

    | Improve this Doc View Source

    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.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information.

    | Improve this Doc View Source

    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.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information.

    | Improve this Doc View Source

    NumberDateFormat(String, IFormatProvider)

    Constructs a NumberDateFormat object using the given dateFormat and provider.

    Declaration
    public NumberDateFormat(string dateFormat, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String dateFormat

    Date format used to parse and format dates.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information.

    Properties

    | Improve this Doc View Source

    NumericRepresentation

    The numeric representation to convert the date into when calling Parse(String) or convert the date from when calling Format(Int64) overloads.

    Declaration
    public NumericRepresentation NumericRepresentation { get; set; }
    Property Value
    Type Description
    Lucene.Net.Documents.NumericRepresentation
    | Improve this Doc View Source

    TimeZone

    The time zone to convert dates to when using Format(Int64) or from when using Parse(String).

    Declaration
    public virtual TimeZoneInfo TimeZone { get; set; }
    Property Value
    Type Description
    System.TimeZoneInfo

    Methods

    | Improve this Doc View Source

    Format(Double)

    Declaration
    public override string Format(double number)
    Parameters
    Type Name Description
    System.Double number
    Returns
    Type Description
    System.String
    Overrides
    NumberFormat.Format(Double)
    | Improve this Doc View Source

    Format(Int64)

    Declaration
    public override string Format(long number)
    Parameters
    Type Name Description
    System.Int64 number
    Returns
    Type Description
    System.String
    Overrides
    NumberFormat.Format(Int64)
    | Improve this Doc View Source

    Format(Object)

    Declaration
    public override string Format(object number)
    Parameters
    Type Name Description
    System.Object number
    Returns
    Type Description
    System.String
    Overrides
    NumberFormat.Format(Object)
    | Improve this Doc View Source

    GetDateFormat()

    Returns the .NET date format that will be used to Format the date. Note that parsing the date uses System.DateTime.ParseExact(System.String,System.String,System.IFormatProvider).

    Declaration
    public string GetDateFormat()
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    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.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information. If null the culture of the current thread will be used.

    Returns
    Type Description
    System.String

    A date and time format string with a space separator.

    | Improve this Doc View Source

    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.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information. If null the culture of the current thread will be used.

    Returns
    Type Description
    System.String

    A date format string.

    | Improve this Doc View Source

    Parse(String)

    Declaration
    public override Number Parse(string source)
    Parameters
    Type Name Description
    System.String source
    Returns
    Type Description
    J2N.Numerics.Number
    Overrides
    NumberFormat.Parse(String)
    | Improve this Doc View Source

    SetDateFormat(String)

    Declaration
    public void SetDateFormat(string dateFormat)
    Parameters
    Type Name Description
    System.String dateFormat
    • Improve this Doc
    • View Source
    Back to top Copyright © 2022 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.