SqlDateTime SqlDateTime SqlDateTime SqlDateTime Struct

定義

表示要存放在資料庫或從資料庫擷取的日期與時間資料,值範圍從 1753 年 1 月 1 日至 9999 年 12 月 31 日,精確度為 3.33 毫秒。Represents the date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds to be stored in or retrieved from a database. SqlDateTime 結構擁有的基礎資料結構與其對應的 .NET Framework 型別 DateTime 不同,後者可以表示介於 0001 年 1 月 1 日上午 12:00:00 到 9999 年 12 月 31 日下午 11:59:59 的任何時間,精確度可達 100 奈秒。The SqlDateTime structure has a different underlying data structure from its corresponding .NET Framework type, DateTime, which can represent any time between 12:00:00 AM 1/1/0001 and 11:59:59 PM 12/31/9999, to the accuracy of 100 nanoseconds. SqlDateTime 實際儲存的則是與 1900 年 1 月 1 日上午 00:00:00 的相對差異。SqlDateTime actually stores the relative difference to 00:00:00 AM 1/1/1900. 因此將 "00:00:00 AM 1/1/1900" 轉換成整數的結果將傳回 0。Therefore, a conversion from "00:00:00 AM 1/1/1900" to an integer will return 0.

public value class SqlDateTime : IComparable, System::Data::SqlTypes::INullable, System::Xml::Serialization::IXmlSerializable
[System.Serializable]
public struct SqlDateTime : IComparable, System.Data.SqlTypes.INullable, System.Xml.Serialization.IXmlSerializable
type SqlDateTime = struct
    interface INullable
    interface IXmlSerializable
Public Structure SqlDateTime
Implements IComparable, INullable, IXmlSerializable
繼承
SqlDateTimeSqlDateTimeSqlDateTimeSqlDateTime
屬性
實作

建構函式

SqlDateTime(DateTime) SqlDateTime(DateTime) SqlDateTime(DateTime) SqlDateTime(DateTime)

使用指定的 DateTime 值,初始化 SqlDateTime 結構的新執行個體。Initializes a new instance of the SqlDateTime structure using the specified DateTime value.

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

使用提供的參數,初始化 SqlDateTime 結構的新執行個體。Initializes a new instance of the SqlDateTime structure using the supplied parameters.

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

使用提供的參數來初始化年、月、日,初始化 SqlDateTime 結構的新執行個體。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) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32)

使用提供的參數初始化新結構的年、月、日、時、分和秒,以初始化 SqlDateTime 結構的新執行個體。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) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Double) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Double) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Double)

使用提供的參數初始化新結構的年、月、日、時、分、秒和毫秒,以初始化 SqlDateTime 結構的新執行個體。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) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32) SqlDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)

使用提供的參數初始化新結構的年、月、日、時、分、秒和微秒,以初始化 SqlDateTime 結構的新執行個體。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.

欄位

MaxValue MaxValue MaxValue MaxValue

表示 SqlDateTime 結構的最大有效日期值。Represents the maximum valid date value for a SqlDateTime structure.

MinValue MinValue MinValue MinValue

表示 SqlDateTime 結構的最小有效日期值。Represents the minimum valid date value for a SqlDateTime structure.

Null Null Null Null

表示 DBNull,可以指派至 SqlDateTime 結構的執行個體。Represents a DBNull that can be assigned to this instance of the SqlDateTime structure.

SQLTicksPerHour SQLTicksPerHour SQLTicksPerHour SQLTicksPerHour

常數的值相當於 1 小時的刻度數。A constant whose value is the number of ticks equivalent to one hour.

SQLTicksPerMinute SQLTicksPerMinute SQLTicksPerMinute SQLTicksPerMinute

常數的值相當於 1 分鐘的刻度數。A constant whose value is the number of ticks equivalent to one minute.

SQLTicksPerSecond SQLTicksPerSecond SQLTicksPerSecond SQLTicksPerSecond

常數的值相當於 1 秒鐘的刻度數。A constant whose value is the number of ticks equivalent to one second.

屬性

DayTicks DayTicks DayTicks DayTicks

取得表示這個 SqlDateTime 結構的日期的刻度數。Gets the number of ticks representing the date of this SqlDateTime structure.

IsNull IsNull IsNull IsNull

表示這個 SqlDateTime 結構是否為 Null。Indicates whether this SqlDateTime structure is null.

TimeTicks TimeTicks TimeTicks TimeTicks

取得表示這個 SqlDateTime 結構的時間的刻度數。Gets the number of ticks representing the time of this SqlDateTime structure.

Value Value Value Value

取得 SqlDateTime 結構的值。Gets the value of the SqlDateTime structure. 這個屬性是唯讀的。This property is read-only.

方法

Add(SqlDateTime, TimeSpan) Add(SqlDateTime, TimeSpan) Add(SqlDateTime, TimeSpan) Add(SqlDateTime, TimeSpan)

SqlDateTime 加入至指定的 TimeSpanAdds a SqlDateTime to the specified TimeSpan.

CompareTo(SqlDateTime) CompareTo(SqlDateTime) CompareTo(SqlDateTime) CompareTo(SqlDateTime)

將這個 SqlDateTime 結構與提供的 SqlDateTime 結構相比較,並傳回它們相對值的指示。Compares this SqlDateTime structure to the supplied SqlDateTime structure and returns an indication of their relative values.

CompareTo(Object) CompareTo(Object) CompareTo(Object) CompareTo(Object)

將這個 SqlDateTime 結構與提供的 Object 相比較,並傳回它們相對值的指示。Compares this SqlDateTime structure to the supplied Object and returns an indication of their relative values.

Equals(SqlDateTime, SqlDateTime) Equals(SqlDateTime, SqlDateTime) Equals(SqlDateTime, SqlDateTime) Equals(SqlDateTime, SqlDateTime)

執行兩個 SqlDateTime 結構的邏輯比對,以判斷它們是否相等。Performs a logical comparison of two SqlDateTime structures to determine whether they are equal.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

將提供的物件參數與 Value 物件的 SqlDateTime 屬性相比較。Compares the supplied object parameter to the Value property of the SqlDateTime object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

取得這個執行個體的雜湊程式碼。Gets the hash code for this instance.

GetXsdType(XmlSchemaSet) GetXsdType(XmlSchemaSet) GetXsdType(XmlSchemaSet) GetXsdType(XmlSchemaSet)

傳回指定之 XmlSchemaSet 的 XML 結構描述定義語言 (XSD)。Returns the XML Schema definition language (XSD) of the specified XmlSchemaSet.

GreaterThan(SqlDateTime, SqlDateTime) GreaterThan(SqlDateTime, SqlDateTime) GreaterThan(SqlDateTime, SqlDateTime) GreaterThan(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否大於第二個。Compares two instances of SqlDateTime to determine whether the first is greater than the second.

GreaterThanOrEqual(SqlDateTime, SqlDateTime) GreaterThanOrEqual(SqlDateTime, SqlDateTime) GreaterThanOrEqual(SqlDateTime, SqlDateTime) GreaterThanOrEqual(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否大於或等於第二個。Compares two instances of SqlDateTime to determine whether the first is greater than or equal to the second.

LessThan(SqlDateTime, SqlDateTime) LessThan(SqlDateTime, SqlDateTime) LessThan(SqlDateTime, SqlDateTime) LessThan(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否小於第二個。Compares two instances of SqlDateTime to determine whether the first is less than the second.

LessThanOrEqual(SqlDateTime, SqlDateTime) LessThanOrEqual(SqlDateTime, SqlDateTime) LessThanOrEqual(SqlDateTime, SqlDateTime) LessThanOrEqual(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否小於或等於第二個。Compares two instances of SqlDateTime to determine whether the first is less than or equal to the second.

NotEquals(SqlDateTime, SqlDateTime) NotEquals(SqlDateTime, SqlDateTime) NotEquals(SqlDateTime, SqlDateTime) NotEquals(SqlDateTime, SqlDateTime)

執行兩個 SqlDateTime 執行個體的邏輯比對,以判斷它們是否相等。Performs a logical comparison of two instances of SqlDateTime to determine whether they are not equal.

Parse(String) Parse(String) Parse(String) Parse(String)

將日期與時間之指定的 String 表示轉換成它的 SqlDateTime 對等用法。Converts the specified String representation of a date and time to its SqlDateTime equivalent.

Subtract(SqlDateTime, TimeSpan) Subtract(SqlDateTime, TimeSpan) Subtract(SqlDateTime, TimeSpan) Subtract(SqlDateTime, TimeSpan)

從這個 SqlDateTime 執行個體中減去指定的 TimespanSubtracts the specified Timespan from this SqlDateTime instance.

ToSqlString() ToSqlString() ToSqlString() ToSqlString()

將這個 SqlDateTime 結構轉換為 SqlStringConverts this SqlDateTime structure to SqlString.

ToString() ToString() ToString() ToString()

將這個 SqlDateTime 結構轉換成 StringConverts this SqlDateTime structure to a String.

運算子

Addition(SqlDateTime, TimeSpan) Addition(SqlDateTime, TimeSpan) Addition(SqlDateTime, TimeSpan) Addition(SqlDateTime, TimeSpan)

將提供的 TimeSpan 參數 (t) 指示的時期間加入至提供的 SqlDateTime 結構中。Adds the period of time indicated by the supplied TimeSpan parameter, t, to the supplied SqlDateTime structure.

Equality(SqlDateTime, SqlDateTime) Equality(SqlDateTime, SqlDateTime) Equality(SqlDateTime, SqlDateTime) Equality(SqlDateTime, SqlDateTime)

執行兩個 SqlDateTime 結構的邏輯比對,以判斷它們是否相等。Performs a logical comparison of two SqlDateTime structures to determine whether they are equal.

Explicit(SqlDateTime to DateTime) Explicit(SqlDateTime to DateTime) Explicit(SqlDateTime to DateTime) Explicit(SqlDateTime to DateTime)

SqlDateTime 結構轉換成 DateTime 結構。Converts the SqlDateTime structure to a DateTime structure.

Explicit(SqlString to SqlDateTime) Explicit(SqlString to SqlDateTime) Explicit(SqlString to SqlDateTime) Explicit(SqlString to SqlDateTime)

SqlString 參數轉換成 SqlDateTimeConverts the SqlString parameter to a SqlDateTime.

GreaterThan(SqlDateTime, SqlDateTime) GreaterThan(SqlDateTime, SqlDateTime) GreaterThan(SqlDateTime, SqlDateTime) GreaterThan(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否大於第二個。Compares two instances of SqlDateTime to determine whether the first is greater than the second.

GreaterThanOrEqual(SqlDateTime, SqlDateTime) GreaterThanOrEqual(SqlDateTime, SqlDateTime) GreaterThanOrEqual(SqlDateTime, SqlDateTime) GreaterThanOrEqual(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否大於或等於第二個。Compares two instances of SqlDateTime to determine whether the first is greater than or equal to the second.

Implicit(DateTime to SqlDateTime) Implicit(DateTime to SqlDateTime) Implicit(DateTime to SqlDateTime) Implicit(DateTime to SqlDateTime)

DateTime 結構轉換成 SqlDateTime 結構。Converts a DateTime structure to a SqlDateTime structure.

Inequality(SqlDateTime, SqlDateTime) Inequality(SqlDateTime, SqlDateTime) Inequality(SqlDateTime, SqlDateTime) Inequality(SqlDateTime, SqlDateTime)

執行兩個 SqlDateTime 執行個體的邏輯比對,以判斷它們是否相等。Performs a logical comparison of two instances of SqlDateTime to determine whether they are not equal.

LessThan(SqlDateTime, SqlDateTime) LessThan(SqlDateTime, SqlDateTime) LessThan(SqlDateTime, SqlDateTime) LessThan(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否小於第二個。Compares two instances of SqlDateTime to determine whether the first is less than the second.

LessThanOrEqual(SqlDateTime, SqlDateTime) LessThanOrEqual(SqlDateTime, SqlDateTime) LessThanOrEqual(SqlDateTime, SqlDateTime) LessThanOrEqual(SqlDateTime, SqlDateTime)

比較 SqlDateTime 的兩個執行個體,判斷第一個執行個體是否小於或等於第二個。Compares two instances of SqlDateTime to determine whether the first is less than or equal to the second.

Subtraction(SqlDateTime, TimeSpan) Subtraction(SqlDateTime, TimeSpan) Subtraction(SqlDateTime, TimeSpan) Subtraction(SqlDateTime, TimeSpan)

從提供的 TimeSpan 結構中減去提供的 SqlDateTime 結構 (t)。Subtracts the supplied TimeSpan structure, t, from the supplied SqlDateTime structure.

明確介面實作

IXmlSerializable.GetSchema() IXmlSerializable.GetSchema() IXmlSerializable.GetSchema() IXmlSerializable.GetSchema()

此成員支援 .NET Framework 基礎結構,並不能直接使用於您的程式碼中。This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader)

此成員支援 .NET Framework 基礎結構,並不能直接使用於您的程式碼中。This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter)

此成員支援 .NET Framework 基礎結構,並不能直接使用於您的程式碼中。This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

適用於

另請參閱