public static AddDate ( Field dateField, Field datePart, Field value ) : Field | ||
dateField | Field | |
datePart | Field | |
value | Field | |
Результат | Field |
private void DateFunctions() { Register(config => config.Named("date") .WhenExecute(context => Simple(context, () => SystemFunctions.CurrentDate(context.Request))) .ReturnsType(PrimitiveTypes.Date())); Register(config => config.Named("time") .WhenExecute(context => Simple(context, () => SystemFunctions.CurrentTime(context.Request))) .ReturnsType(PrimitiveTypes.Time())); Register(config => config.Named("timestamp") .WhenExecute(context => Simple(context, () => SystemFunctions.CurrentTimeStamp(context.Request))) .ReturnsDateTime()); Register(config => config.Named("system_date") .WhenExecute(context => Simple(context, SystemFunctions.SystemDate)) .ReturnsType(PrimitiveTypes.Date())); Register(config => config.Named("system_time") .WhenExecute(context => Simple(context, SystemFunctions.SystemTime)) .ReturnsType(PrimitiveTypes.Time())); Register(config => config .Named("system_timestamp") .WhenExecute(context => Simple(context, SystemFunctions.SystemTimeStamp)) .ReturnsDateTime()); // ADD_DATE Register(config => config.Named("add_date") .WithDateTimeParameter("date") .WithStringParameter("datePart") .WithNumericParameter("value") .WhenExecute(context => Simple(context, args => SystemFunctions.AddDate(args[0], args[1], args[2]))) .ReturnsDateTime()); // EXTRACT Register(config => config.Named("extract") .WithDateTimeParameter("date") .WithStringParameter("unit") .WhenExecute(context => Simple(context, args => SystemFunctions.Extract(args[0], args[1]))) .ReturnsNumeric()); // DATEFORMAT Register(config => config.Named("dateformat") .WithDateTimeParameter("date") .WithStringParameter("format") .WhenExecute(context => Simple(context, args => SystemFunctions.DateFormat(args[0], args[1]))) .ReturnsString()); // NEXT_DAY Register(config => config .Named("next_day") .WithDateTimeParameter("date") .WithStringParameter("dayOfWeek") .WhenExecute(context => Simple(context, args => SystemFunctions.NextDay(args[0], args[1]))) .ReturnsDateTime()); }