DateTime.Equals メソッドとは? わかりやすく解説

DateTime.Equals メソッド (DateTime)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

このインスタンスが、指定した DateTime インスタンス等しかどうかを示す値を返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DateTime.Equals メソッド (Object)

対象インスタンスが、指定したオブジェクト等しかどうかを示す値を返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

使用例使用例

Equals メソッドコード例次に示します

Dim today1 As New System.DateTime(System.DateTime.Today.Ticks)
Dim today2 As New System.DateTime(System.DateTime.Today.Ticks)
Dim tomorrow As New System.DateTime(
 _
                        System.DateTime.Today.AddDays(1).Ticks)

' todayEqualsToday gets true.
Dim todayEqualsToday As Boolean
 = System.DateTime.Equals(today1, today2)

' todayEqualsTomorrow gets false.
Dim todayEqualsTomorrow As Boolean
 = System.DateTime.Equals(today1, tomorrow)
System.DateTime today1 = 
        new System.DateTime(System.DateTime.Today.Ticks);
System.DateTime today2 = 
        new System.DateTime(System.DateTime.Today.Ticks);
System.DateTime tomorrow = 
        new System.DateTime(
                    System.DateTime.Today.AddDays(1).Ticks);

// todayEqualsToday gets true.
bool todayEqualsToday = System.DateTime.Equals(today1, today2);

// todayEqualsTomorrow gets false.
bool todayEqualsTomorrow = System.DateTime.Equals(today1, tomorrow);
System::DateTime today1 = System::DateTime(
   System::DateTime::Today.Ticks );
System::DateTime today2 = System::DateTime(
   System::DateTime::Today.Ticks );
System::DateTime tomorrow = System::DateTime(
   System::DateTime::Today.AddDays( 1 ).Ticks );

// todayEqualsToday gets true.
bool todayEqualsToday = System::DateTime::Equals( today1, today2
 );

// todayEqualsTomorrow gets false.
bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow
 );
System.DateTime today1 = new System.DateTime(System.DateTime.
    get_Today().get_Ticks());
System.DateTime today2 = new System.DateTime(System.DateTime.
    get_Today().get_Ticks());
System.DateTime tomorrow = new System.DateTime(System.DateTime.
    get_Today().AddDays(1).get_Ticks());
// todayEqualsToday gets true.
boolean todayEqualsToday = System.DateTime.Equals(today1, today2);
// todayEqualsTomorrow gets false.
boolean todayEqualsTomorrow = System.DateTime.Equals(today1, tomorrow);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DateTime.Equals メソッド


DateTime.Equals メソッド (DateTime, DateTime)

DateTime2 つインスタンス等しかどうかを示す値を返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

使用例使用例

Equals メソッドコード例次に示します

Dim today1 As New System.DateTime(System.DateTime.Today.Ticks)
Dim today2 As New System.DateTime(System.DateTime.Today.Ticks)
Dim tomorrow As New System.DateTime(
 _
                        System.DateTime.Today.AddDays(1).Ticks)

' todayEqualsToday gets true.
Dim todayEqualsToday As Boolean
 = System.DateTime.Equals(today1, today2)

' todayEqualsTomorrow gets false.
Dim todayEqualsTomorrow As Boolean
 = System.DateTime.Equals(today1, tomorrow)
System.DateTime today1 = 
        new System.DateTime(System.DateTime.Today.Ticks);
System.DateTime today2 = 
        new System.DateTime(System.DateTime.Today.Ticks);
System.DateTime tomorrow = 
        new System.DateTime(
                    System.DateTime.Today.AddDays(1).Ticks);

// todayEqualsToday gets true.
bool todayEqualsToday = System.DateTime.Equals(today1, today2);

// todayEqualsTomorrow gets false.
bool todayEqualsTomorrow = System.DateTime.Equals(today1, tomorrow);
System::DateTime today1 = System::DateTime(
   System::DateTime::Today.Ticks );
System::DateTime today2 = System::DateTime(
   System::DateTime::Today.Ticks );
System::DateTime tomorrow = System::DateTime(
   System::DateTime::Today.AddDays( 1 ).Ticks );

// todayEqualsToday gets true.
bool todayEqualsToday = System::DateTime::Equals( today1, today2
 );

// todayEqualsTomorrow gets false.
bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow
 );
System.DateTime today1 = new System.DateTime(System.DateTime.
    get_Today().get_Ticks());
System.DateTime today2 = new System.DateTime(System.DateTime.
    get_Today().get_Ticks());
System.DateTime tomorrow = new System.DateTime(System.DateTime.
    get_Today().AddDays(1).get_Ticks());
// todayEqualsToday gets true.
boolean todayEqualsToday = System.DateTime.Equals(today1, today2);
// todayEqualsTomorrow gets false.
boolean todayEqualsTomorrow = System.DateTime.Equals(today1, tomorrow);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

DateTime.Equals メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DateTime.Equals メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS