Skip to content

DateDiffAttribute class

namespace: Serenity.Data.Mapping   assembly: Serenity.Net.Services

DateDiff expression attribute, which returns the number of date part boundaries crossed between two dates like DATEDIFF of SQL Server, e.g. one day from 23:00 to 01:00 of the next day, and one year from December 31 to January 1, rather than the number of complete units between them.

[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public class DateDiffAttribute : BaseExpressionAttribute
parameter description
part Datepart like "year", "month" etc.
start An expression that returns a date value
end An expression that returns a date value

Public Members

name description
DateDiffAttribute(…) DateDiff expression attribute, which returns the number of date part boundaries crossed between two dates like DATEDIFF of SQL Server, e.g. one day from 23:00 to 01:00 of the next day, and one year from December 31 to January 1, rather than the number of complete units between them.
End { get; } Date expression 2.
Part { get; } Date part.
Start { get; } Date expression 1.
override Translate(…)

Exceptions

exception condition
ArgumentNullException One of expressions is null

Remarks

Creates a new instance

See Also