LoginSignup
3
1

More than 5 years have passed since last update.

C#で今日の日付を表示する

Posted at

日付や時刻を扱ういくつかのクラスの中で、主役となるのは「DateTime構造体」である。
現在の日付および時刻を取得するためには、そのスタティックなNowメソッドを使用する。
現在の日付だけがほしい場合は、Todayメソッドを使用する。


DateTime today = DateTime.Today;

Debug.WriteLine("今日の日付は:" + today);

DateTime now = DateTime.Now;

Debug.WriteLine("現在の日付は:" + now);

結果:
スケッチ (7).png

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1