How to set DateTime to null

前端 未结 6 1158
半阙折子戏
半阙折子戏 2021-01-31 13:25

Using C#. I have a string dateTimeEnd.

If the string is in right format, I wish to generate a DateTime and assign it to eventCustom.DateTimeEnd

6条回答
  •  一整个雨季
    2021-01-31 14:25

    DateTime is a non-nullable value type

    DateTime? newdate = null;
    

    You can use a Nullable

    c# Nullable Datetime

提交回复
热议问题