简体   繁体   English

什么是 .Net 类型相当于 Paradox 数据库中的时间

[英]What is the .Net type equivalent to Time in Paradox Database

I'm accessing Paradox file by binary reading.我正在通过二进制读取访问 Paradox 文件。

But I have a question.但我有一个问题。 I don't know what conversion should I to do from Time in Paradox Database:我不知道我应该从 Paradox 数据库中的 Time 进行什么转换:

  • TimeSpan时间跨度
  • DateTime约会时间
  • Or I should to convert to string或者我应该转换为字符串

The DateTime will always has the date part. DateTime将始终具有日期部分。

The TimeSpan is most likely what you need. TimeSpan很可能是您所需要的。 It can keep the hours, minutes... without date.它可以保持小时、分钟......没有日期。

EDIT : reaction to incorrect comment编辑:对不正确评论的反应

Suggested mapping of the Time to DateTime is simply incorrect abstraction.建议的 Time 到 DateTime 映射只是不正确的抽象。 Theny your C# property contains a date 01/01/0001 which is wrong (not intended) and also most be handled all the time you access such a property.你的 C# 属性包含一个日期 01/01/0001,这是错误的(不是故意的),而且大多数时候你访问这样的属性都会被处理。

While TimeSpan , can show exactly what we want: the time ellpased from the middnight.TimeSpan ,可以准确显示我们想要的:从午夜开始的时间。 So if we do map time from DB type, this will provide us with out of the box functionality: can be loaded as time, can be stored as a time.因此,如果我们从 DB 类型映射时间,这将为我们提供开箱即用的功能:可以作为时间加载,可以作为时间存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM