Table of Contents

Class Today

Namespace
YndigoBlue.Velocity.Functions
Assembly
YndigoBlue.Velocity.dll

Represents the TODAY date function that returns the current date without the time component.

public class Today : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
Inheritance
Today
Implements

Remarks

The TODAY function returns the current date with the time set to midnight (00:00:00). This is useful for date comparisons, filtering records from today, or calculating date-only differences. Unlike NOW, TODAY excludes the time component, making it ideal for day-level granularity operations.

Examples

Select today's date alongside each row using TODAY as a column expression:

var schema = manager.LoadSchema("reports");
var sales = schema["sales"];

var query = new Query()
    .Select([ sales["id"], sales["amount"], new Expression("report_date", new Today()) ])
    .From(sales);

var results = manager.Retrieve(query);

Calculate the number of days remaining until each task's due date using DateDiff:

var schema = manager.LoadSchema("projects");
var tasks = schema["tasks"];

var query = new Query()
    .Select([ tasks["id"], tasks["title"],
              new Expression("days_remaining", new DateDiff(DatePart.Day, new Today(), tasks["due_date"])) ])
    .From(tasks);

var results = manager.Retrieve(query);

Constructors

Today()

Initializes a new instance of TODAY with no arguments. Returns the current date (without time component) from the database server.