Not sure why you'd want to convert a date to float - but try datetime or
smalldatetime instead of converting to float and you should have no issues -


Check BOL for conversion types to/from and the matrix grid - 


Kevin Penny, MMCP
[EMAIL PROTECTED]
Lead Developer, HotGigs.com
 "Not now I'm multitasking"
 
-----Original Message-----
From: Richard Dillman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 19, 2006 4:07 PM
To: CF-Talk
Subject: Why does this happen with SQL Server 2000 and CFML?

 <cfquery name="qryDate" datasource="#request.dsn#">
  Select convert(float,getdate()) as datetimefromdb
 </cfquery>

 <cfoutput query="qryDate">
  display that with: #val(datetimefromdb - 0)#
  Returns 38734.6939544 (or whatever date/time it is)

  display that with: #dateformat(val(datetimefromdb-0), "dd-mmm-yy")#
  Returns 17-Jan-06 (what? thats 2 days ago)
 </cfoutput>

Now use select getdate() as datetimefromdb in your Query

 <cfquery name=qryDate" datasource="#request.dsn#">
  select getdate() as datetimefromdb
 </cfquery>

 <cfoutput query="qryDate">
  display that with: #val(datetimefromdb - 0)#
  Returns 38736.6939468 (hrm differen date)

  display that with: #dateformat(val(datetimefromdb-0), "dd-mmm-yy")#
  Returns 19-Jan-06 (success todays date)
 </cfoutput>

But why would i get 2 different dates?


--
Richard Dillman

"The most important step is always the first one."




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230257
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to