Should I store DateTimes as a Long (Ticks) in a database?

后端 未结 4 2027
刺人心
刺人心 2021-01-12 11:00

Could life be made easier by saving DateTime values as a long instead? There always seem to be problems when working with null DateTime values, whether storing

4条回答
  •  终归单人心
    2021-01-12 11:51

    I guess that's down to personal preference. I always work with datetime types and don't have any bother with them.

    If you store them as longs though semantically they are no longer dates. If you ever wanted to do a query to select all accounts added on a Friday (say) you would have to jump through several hoops to work that out.

提交回复
热议问题