什么是处理BC日期的.NET / SQL服务器的最佳方式是什么? [英] What is the best way to handle bc dates in .net / sql server?
问题描述
我打算建立一个时间表应用程序,存储和显示信息的具体日期。 例如:亚里士多德384年 - 公元前322年;也有像康德1724年4月22日的广告日期 - 1804年12月2日)。
I'm planning to create a timeline application that stores and displays information for specific dates. For example: Aristotle 384 BC - 322 BC; but also ad dates like Immanuel Kant 22.04.1724 - 12.02.1804).
我想使用一个SQL Compact Edition数据库。日期时间格式允许的日期从1753年1月1日12:00:00:00点至12/31/9999下午11点59分59秒。所以我不能使用本机日期时间格式。 .NET也使用本地DateTime类(0001.01.01是第一天)不允许公元前日期。
I want to use a sql compact edition database. The datetime format allows dates from 1/1/1753 12:00:00:00 AM to 12/31/9999 11:59:59 PM. So I can't use the native datetime format. .Net also doesn't allow bc dates using the native DateTime class (0001.01.01 is the first day).
我必须使用VARCHAR列来定义自己的格式和净解析这些价值观?
Do I have to define my own format using a varchar column and in .Net parse those values?
推荐答案
您可以看看的野田佳彦时中,乔达时间为.NET端口,它不处理历史日期(但你仍然不得不处理持久自己)。
You could have a look at noda-time, a port of Joda-time for .NET, which does handle historic dates (but you'd still have to handle persistence yourself).
这篇关于什么是处理BC日期的.NET / SQL服务器的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!