SqlDateTime Constructors

Definition

Initializes a new instance of the SqlDateTime structure.

Overloads

SqlDateTime(DateTime)

Initializes a new instance of the SqlDateTime structure using the specified DateTime value.

SqlDateTime(Int32, Int32)

Initializes a new instance of the SqlDateTime structure using the supplied parameters.

SqlDateTime(Int32, Int32, Int32)

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day.

SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32)

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day, hour, minute, and second of the new structure.

SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Double)

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day, hour, minute, second, and millisecond of the new structure.

SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day, hour, minute, second, and microsecond of the new structure.

SqlDateTime(DateTime)

Source:
SQLDateTime.cs
Source:
SQLDateTime.cs
Source:
SQLDateTime.cs

Initializes a new instance of the SqlDateTime structure using the specified DateTime value.

C#
public SqlDateTime(DateTime value);

Parameters

value
DateTime

A DateTime structure.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 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
.NET Standard 2.0, 2.1

SqlDateTime(Int32, Int32)

Source:
SQLDateTime.cs
Source:
SQLDateTime.cs
Source:
SQLDateTime.cs

Initializes a new instance of the SqlDateTime structure using the supplied parameters.

C#
public SqlDateTime(int dayTicks, int timeTicks);

Parameters

dayTicks
Int32

An integer value that represents the date as ticks.

timeTicks
Int32

An integer value that represents the time as ticks.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 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
.NET Standard 2.0, 2.1

SqlDateTime(Int32, Int32, Int32)

Source:
SQLDateTime.cs
Source:
SQLDateTime.cs
Source:
SQLDateTime.cs

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day.

C#
public SqlDateTime(int year, int month, int day);

Parameters

year
Int32

An integer representing the year of the of the new SqlDateTime structure.

month
Int32

An integer value representing the month of the new SqlDateTime structure.

day
Int32

An integer value representing the day number of the new SqlDateTime structure.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 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
.NET Standard 2.0, 2.1

SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32)

Source:
SQLDateTime.cs
Source:
SQLDateTime.cs
Source:
SQLDateTime.cs

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day, hour, minute, and second of the new structure.

C#
public SqlDateTime(int year, int month, int day, int hour, int minute, int second);

Parameters

year
Int32

An integer value representing the year of the new SqlDateTime structure.

month
Int32

An integer value representing the month of the new SqlDateTime structure.

day
Int32

An integer value representing the day of the month of the new SqlDateTime structure.

hour
Int32

An integer value representing the hour of the new SqlDateTime structure.

minute
Int32

An integer value representing the minute of the new SqlDateTime structure.

second
Int32

An integer value representing the second of the new SqlDateTime structure.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 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
.NET Standard 2.0, 2.1

SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Double)

Source:
SQLDateTime.cs
Source:
SQLDateTime.cs
Source:
SQLDateTime.cs

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day, hour, minute, second, and millisecond of the new structure.

C#
public SqlDateTime(int year, int month, int day, int hour, int minute, int second, double millisecond);

Parameters

year
Int32

An integer value representing the year of the new SqlDateTime structure.

month
Int32

An integer value representing the month of the new SqlDateTime structure.

day
Int32

An integer value representing the day of the month of the new SqlDateTime structure.

hour
Int32

An integer value representing the hour of the new SqlDateTime structure.

minute
Int32

An integer value representing the minute of the new SqlDateTime structure.

second
Int32

An integer value representing the second of the new SqlDateTime structure.

millisecond
Double

An double value representing the millisecond of the new SqlDateTime structure.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 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
.NET Standard 2.0, 2.1

SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

Source:
SQLDateTime.cs
Source:
SQLDateTime.cs
Source:
SQLDateTime.cs

Initializes a new instance of the SqlDateTime structure using the supplied parameters to initialize the year, month, day, hour, minute, second, and microsecond of the new structure.

C#
public SqlDateTime(int year, int month, int day, int hour, int minute, int second, int bilisecond);

Parameters

year
Int32

An integer value representing the year of the new SqlDateTime structure.

month
Int32

An integer value representing the month of the new SqlDateTime structure.

day
Int32

An integer value representing the day of the new SqlDateTime structure.

hour
Int32

An integer value representing the hour of the new SqlDateTime structure.

minute
Int32

An integer value representing the minute of the new SqlDateTime structure.

second
Int32

An integer value representing the second of the new SqlDateTime structure.

bilisecond
Int32

An integer value representing the microsecond (thousandths of a millisecond) of the new SqlDateTime structure.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 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
.NET Standard 2.0, 2.1