Presentation of birth dates

I’m working on a C # journal system in our local church, but I’m having problems connecting to the database while storing birth dates. According to MSDN , the date on the list can be presented on January 1, 1. How can I record the date of birth of Jesus Christ and earlier personalities that are important to us?

+3
source share
4 answers

You will have to collapse your own class for processing BC dates in .NET and store them in the database either as strings or as separate fields for a year, a month (depending on what accuracy is required) if search and sorting is required to be executed on the database side (which I assume you would be).

SQL Server support for dates is more restrictive than .NET (it only returns until 1753 or 1752 or so).

, , . , . , , , IComparable, IEquatable, IFormattable , , IConvertible, , .

+1

- , . , .

An alternative answer - there are standard ways to convert dates to number of days and back ...

http://en.wikipedia.org/wiki/Julian_day

If you do the conversion yourself, you basically save the number (which just means the date), so you shouldn't have a problem. Good - also to make sure your transformations are correct.

0
source

Source: https://habr.com/ru/post/1777340/


All Articles