• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 628
  • Last Modified:

SQL Server DateTime to Float conversion

I am currently doing the following when in my SQL stored proc to convert a DateTime to a Float.

CAST([my_Date] AS FLOAT) + 2 as ConDate

This works fine except when I have a date such as '2010-11-11 00:00:00.000'.  Then the result is returned with no decimal places and when I convert that to a date in a .NET application it is translated as 2010-11-11 12:00:00.000 which isn't correct.

Anyone know if I can force the extra three decimal places?
0
briancostea
Asked:
briancostea
  • 2
1 Solution
 
cyberkiwiCommented:
CAST(my_date as decimal(20,10)) + 2
0
 
briancosteaAuthor Commented:
YIKES that was fast.  That solved the problem but unfortunately the Telerik control I am using still doesn't convert it properly.  Awarding points.
0
 
briancosteaAuthor Commented:
Thanks!
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now