SqlMethods.DateDiffMillisecond Method

Definition

Counts the number of millisecond boundaries between two specified dates.

Overloads

DateDiffMillisecond(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

Counts the number of millisecond boundaries between two nullable dates.

DateDiffMillisecond(DateTime, DateTime)

Counts the number of millisecond boundaries between two non-nullable dates.

DateDiffMillisecond(DateTimeOffset, DateTimeOffset)

Counts the number of millisecond boundaries between two non-nullable dates.

DateDiffMillisecond(Nullable<DateTime>, Nullable<DateTime>)

Counts the number of millisecond boundaries between two nullable dates.

Remarks

Corresponds to the SQL Server DATEDIFF function using millisecond to specify the type of time boundary crossed. For more about this SQL Server function, see DATEDIFF.

DateDiffMillisecond(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

Counts the number of millisecond boundaries between two nullable dates.

C#
public static int? DateDiffMillisecond(DateTimeOffset? startDate, DateTimeOffset? endDate);

Parameters

startDate
Nullable<DateTimeOffset>

The start date for the time period.

endDate
Nullable<DateTimeOffset>

The end date for the time period.

Returns

When both parameters are not null, returns the number of millisecond boundaries between the two specified dates. When one or both parameters are null, returns a null value.

Remarks

Corresponds to the SQL Server DATEDIFF function using millisecond to specify the type of time boundary crossed. For more about this SQL Server function, see DATEDIFF.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

DateDiffMillisecond(DateTime, DateTime)

Counts the number of millisecond boundaries between two non-nullable dates.

C#
public static int DateDiffMillisecond(DateTime startDate, DateTime endDate);

Parameters

startDate
DateTime

The start date for the time period.

endDate
DateTime

The end date for the time period.

Returns

The number of millisecond boundaries between the two specified dates.

Remarks

Corresponds to the SQL Server DATEDIFF function using millisecond to specify the type of time boundary crossed. For more about this SQL Server function, see DATEDIFF.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

DateDiffMillisecond(DateTimeOffset, DateTimeOffset)

Counts the number of millisecond boundaries between two non-nullable dates.

C#
public static int DateDiffMillisecond(DateTimeOffset startDate, DateTimeOffset endDate);

Parameters

startDate
DateTimeOffset

The start date for the time period.

endDate
DateTimeOffset

The end date for the time period.

Returns

The number of millisecond boundaries between the two specified dates.

Remarks

Corresponds to the SQL Server DATEDIFF function using millisecond to specify the type of time boundary crossed. For more about this SQL Server function, see DATEDIFF.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

DateDiffMillisecond(Nullable<DateTime>, Nullable<DateTime>)

Counts the number of millisecond boundaries between two nullable dates.

C#
public static int? DateDiffMillisecond(DateTime? startDate, DateTime? endDate);

Parameters

startDate
Nullable<DateTime>

The start date for the time period.

endDate
Nullable<DateTime>

The end date for the time period.

Returns

When both parameters are not null, returns the number of millisecond boundaries between the two specified dates. When one or both parameters are null, returns a null value.

Remarks

Corresponds to the SQL Server DATEDIFF function using millisecond to specify the type of time boundary crossed. For more about this SQL Server function, see DATEDIFF.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1