public static SqlExpression DateTimeAddMonths(SqlExpression _this, [Type(typeof(int))] SqlExpression value) { return(SqlDml.DateTimeAddMonths(_this, value)); }
private static SqlExpression DateTimeOffsetTruncate(SqlExpression dateTimeOffset) => SqlDml.Cast( SqlDml.Cast(dateTimeOffset, new SqlValueType(SqlDateTypeName)), new SqlValueType(SqlDateTime2TypeName));
private static SqlExpression DateTimeOffsetPartOffset(SqlExpression dateTimeOffset) => SqlDml.DateTimeOffsetMinusDateTimeOffset( DateTimeOffsetTruncateOffset(dateTimeOffset), Switchoffset(dateTimeOffset, UtcTimeZone));
protected static SqlUserFunctionCall DateAddSecond(SqlExpression date, SqlExpression seconds) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("SECOND"), seconds, date)); }
protected static SqlUserFunctionCall BitXor(SqlExpression left, SqlExpression right) { return(SqlDml.FunctionCall("BIN_XOR", left, right)); }
protected static SqlUserFunctionCall DateAddMonth(SqlExpression date, SqlExpression months) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("MONTH"), months, date)); }
protected static SqlUserFunctionCall DateAddHour(SqlExpression date, SqlExpression hours) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("HOUR"), hours, date)); }
public static SqlExpression DateTimeMillisecond(SqlExpression _this) { return(ExpressionTranslationHelpers.ToInt(SqlDml.Extract(SqlDateTimePart.Millisecond, _this))); }
public static SqlExpression DateTimeTimeOfDay(SqlExpression _this) { return(SqlDml.DateTimeMinusDateTime(_this, SqlDml.DateTimeTruncate(_this))); }
public static SqlExpression DateTimeNow() { return(SqlDml.CurrentTimeStamp()); }
public static SqlExpression DateTimeToday() { return(SqlDml.CurrentDate()); }
public static SqlExpression DateTimeSubtractDateTime(SqlExpression _this, [Type(typeof(DateTime))] SqlExpression value) { return(SqlDml.DateTimeMinusDateTime(_this, value)); }
public static SqlExpression DateTimeSubtractTimeSpan(SqlExpression _this, [Type(typeof(TimeSpan))] SqlExpression value) { return(SqlDml.DateTimeMinusInterval(_this, value)); }
public static SqlExpression DateTimeAddMilliseconds(SqlExpression _this, [Type(typeof(double))] SqlExpression value) { return(SqlDml.DateTimePlusInterval(_this, TimeSpanCompilers.TimeSpanFromMilliseconds(value))); }
protected static SqlUserFunctionCall DateDiffMillisecond(SqlExpression date1, SqlExpression date2) { return(SqlDml.FunctionCall("DATEDIFF", SqlDml.Native("MILLISECOND"), date1, date2)); }
public static SqlExpression DateTimeDate(SqlExpression _this) { return(SqlDml.DateTimeTruncate(_this)); }
protected static SqlUserFunctionCall DateAddYear(SqlExpression date, SqlExpression years) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("YEAR"), years, date)); }
public static SqlExpression DateTimeDayOfYear(SqlExpression _this) { return(ExpressionTranslationHelpers.ToInt(SqlDml.Extract(SqlDateTimePart.DayOfYear, _this))); }
protected static SqlUserFunctionCall DateAddDay(SqlExpression date, SqlExpression days) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("DAY"), days, date)); }
/// <summary> /// Converts the specified interval expression to expression /// that represents number of milliseconds in that interval. /// This is a generic implementation via <see cref="SqlExtract"/>s. /// It's suitable for any server, but can be inefficient. /// </summary> /// <param name="interval">The interval to convert.</param> /// <returns>Result of conversion.</returns> public static SqlExpression IntervalToNanoseconds(SqlExpression interval) { var nanoseconds = SqlDml.Extract(SqlIntervalPart.Nanosecond, interval); return(IntervalToMilliseconds(interval) * 1000000L + nanoseconds); }
protected static SqlUserFunctionCall DateAddMinute(SqlExpression date, SqlExpression minutes) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("MINUTE"), minutes, date)); }
/// <summary> /// Performs banker's rounding on the speicified argument /// to a specified number of fractional digits. /// </summary> /// <param name="value">The value to round.</param> /// <param name="digits">The digits.</param> /// <returns>Result of rounding.</returns> public static SqlExpression BankersRound(SqlExpression value, SqlExpression digits) { var scale = SqlDml.Power(10, digits); return(BankersRound(value * scale) / scale); }
protected static SqlUserFunctionCall DateAddMillisecond(SqlExpression date, SqlExpression milliseconds) { return(SqlDml.FunctionCall("DATEADD", SqlDml.Native("MILLISECOND"), milliseconds, date)); }
/// <summary> /// Performs "rounding as tought in school" on the specified argument /// to a specified number of fractional digits. /// </summary> /// <param name="argument">The value to round.</param> /// <param name="digits">The digits.</param> /// <returns>Result of rounding.</returns> public static SqlExpression RegularRound(SqlExpression argument, SqlExpression digits) { var scale = SqlDml.Power(10, digits); return(RegularRound(argument * scale) / scale); }
protected static SqlUserFunctionCall BitNot(SqlExpression operand) { return(SqlDml.FunctionCall("BIN_NOT", operand)); }
protected static SqlCast CastToLong(SqlExpression arg) { return(SqlDml.Cast(arg, SqlType.Int64)); }
private static SqlExpression DateTimeOffsetTruncateOffset(SqlExpression dateTimeOffset) => SqlDml.Cast(dateTimeOffset, SqlType.DateTime);
protected static SqlUserFunctionCall DateDiffDay(SqlExpression date1, SqlExpression date2) { return(SqlDml.FunctionCall("DATEDIFF", SqlDml.Native("DAY"), date1, date2)); }
private static SqlExpression DateTimeOffsetTimeOfDay(SqlExpression dateTimeOffset) => DateDiffMillisecond( SqlDml.Native("'00:00:00.0000000'"), SqlDml.Cast(dateTimeOffset, new SqlValueType("time"))) * NanosecondsPerMillisecond;
public static SqlExpression DateTimeOperatorSubtractionDateTime( [Type(typeof(DateTime))] SqlExpression d1, [Type(typeof(DateTime))] SqlExpression d2) { return(SqlDml.DateTimeMinusDateTime(d1, d2)); }