July 17, 2019 at 4:38 pm
Hello!
I have column in SQL 2012 DB of datatype smallint.
Could you please let me know how to convert smallint to date?
Here's the example of smallint data "12940".
Thanks.
July 17, 2019 at 4:41 pm
Hello! I have column in SQL 2012 DB of datatype smallint. Could you please let me know how to convert smallint to date? Here's the example of smallint data "12940". Thanks.
What date does 12940 convert to?
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
July 17, 2019 at 5:26 pm
Assuming that the date occurred in the past...
If that number is supposed to represent '2005-06-06', then the conversion formula is ...
SELECT DATEADD(dd,12940,'1970');
If it's supposed to represent '2015-06-06', then the conversion formula is ...
SELECT DATEADD(dd,12940,'1980');
Both 1970 and 1980 we're the start dates of commonly used epochs.
If neither conversion works for you then, like Michael John stated, we need an example of what a given number would convert to.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 26, 2019 at 9:12 pm
So... enquiring minds want to know... did that work or what???
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply