Q:

How to format an integer date (5 digits) to yyyy-mm-dd in SQL Server?

I have a database with integer fields (columns) named fSystemDate, fOpenned, fStatusDate, etc... I think they represent dates, but I don't know their format. The values in those fields are how these: 76505, 76530, 76554, 76563. 
I do not have examples with the real date associated with them.
Solved. See answers.

A:

I found that this format is part of a programming language called Clarion and his date numbering starts at the date 28-December-1800.
I can convert clarion data to sql date in two ways:

SELECT DATEADD(day, 76505, '28-12-1800')

where the result would be 2010-06-15 00:00:00.

SELECT CONVERT(DateTime,76505 - 36163)

where the result is same. The number 36163 is used to adjust a SQL. This is the number of days between 1-Jan-1900 (MSSQL datetime numbering starts) and 28-Dec-1800 (Clarion datetime numbering starts).

The result in my case is correct because I asked them (my customer) examples of data from your application and compare information.

