1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【C#】DateTimeOffset 型から DateOnly 型に変換する方法

Posted at

コード

DateTimeOffset dateTimeOffset = DateTimeOffset.Now;
DateOnly dateOnly = DateOnly.FromDateTime(dateTimeOffset.LocalDateTime);

Console.WriteLine(dateTimeOffset); //2023/08/05 17:17:29 +09:00
Console.WriteLine(dateOnly); //2023/08/05

参考

  • DateTime と DateTimeOffset 間の変換

  • DateOnly および TimeOnly 構造体の使用方法

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?