Table of Contents

Class DateTimeTools

Namespace: Casewhere.Common
Assembly: Casewhere.Common.dll

class support for lucenequery with datetime. User can't input second and milisecond but the database is storing utc datetime to overcome that, user input dd/MM/yyy format. we automatically add hour and minutes from 00:00:00 -> 23:59:59

public static class DateTimeTools

Inheritance

objectDateTimeTools

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Extension Methods

ObjectExtension.ConvertToBsonValue(object)

Methods

ConverToUtcTimeForLuceneQuery(string, string, string, out DateTime, out DateTime)

Convert the string datetime to specific format

public static bool ConverToUtcTimeForLuceneQuery(string dt, string formatWithOutHour, string formatWithHour, out DateTime minValue, out DateTime maxValue)

Parameters

dt string

formatWithOutHour string

dd/MM/yyyy

formatWithHour string

dd/MM/yyyy HH:mm

minValue DateTime

maxValue DateTime

Returns

bool

IsDateTimeWithSpecificFormat(string, params string[])

public static bool IsDateTimeWithSpecificFormat(string dt, params string[] dtFormats)

Parameters

dt string

dtFormats string[]

Returns

bool