How can I get the current date (w/o hour and minutes)?

前端 未结 7 1582
攒了一身酷
攒了一身酷 2020-12-05 12:33

All I can see in the documentation is Datetime.now() but it returns the Timespan, I need just the date.

7条回答
  •  春和景丽
    2020-12-05 13:29

    There's no class in the core libraries to model a date w/o time. You have to use new DateTime.now().

    Be aware that the date depends on the timezone: 2016-01-20 02:00:00 in Paris is the same instant as 2016-01-19 17:00:00 in Seattle but the day is not the same.

提交回复
热议问题