Table of Contents

Class Now

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

Represents the NOW date/time function that returns the current date and time.

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

Remarks

The NOW function returns the current date and time as a timestamp. The precision and timezone behavior varies by database system (some return UTC, others return local server time). This is useful for timestamping records, calculating elapsed time, or filtering data based on the current moment.

Examples

Select the current server timestamp alongside each session record, and calculate elapsed hours:

var schema = manager.LoadSchema("app");
var sessions = schema["sessions"];

var query = new Query()
    .Select([ sessions["id"], sessions["user_id"],
              new Expression("snapshot_time", new Now()),
              new Expression("elapsed_hours", new DateDiff(DatePart.Hour, sessions["started_at"], new Now())) ])
    .From(sessions);

var results = manager.Retrieve(query);

Constructors

Now()

Initializes a new instance of NOW with no arguments. Returns the current date and time from the database server.