Re: date difference (DateDiff) question?

2004-09-09 Thread Andrew Grosset
Hi,
I would guess you're running MX6.1, the zero represents milliseconds...

On MX6.1 this will correctly output the difference as 3 seconds.




difference in seconds=#dateDiff("s",a,b)#


Andrew.

> Hello everybody,
> 
> I'm working on this script to get the date difference between two 
> dates in minutes. After doing that; I want to then deduct/subtract the 
> value returned by the datediff function from another date value.
> 
> Here is what I'm trying to do:

> 
> Reading the two date values from a table:
> 
> 
> 
> 
> For some reason the dates retuned are in this format:
> 
> Ex: "2004-09-08 12:28:56.0"
> 
> I can't understand why it adds the ".0" after the time when the value 
> stored in the database is "2004-09-08 12:28:56"
> 
> 
> 
> 
> TimeOnHoldReleased)>
> 
> Now, I'm taking the value returned by the dateDiff function and 
> subtracting it from another date
> 
> DateAdd("n",-totalDateDiff,queryTmp.FixDateTime)
> 
> The dates returned are not correct. I don't want I'm doing wrong. Can 
> somebody please point out what I should be doing to correct this.
> 
> Best regards
cfcoder
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: date difference (DateDiff) question?

2004-09-09 Thread Claude Schneegans
Are your dates in the database date type fields?
If yes, the the dates returned in the query are correct.
Sometimes, having an _expression_ like -totalDateDiff causes problem with lousy typed ColdFusion.
I would suggest you invert the two parameters in dateDiff and forget about the minus sign:



DateAdd("n",totalDateDiff,queryTmp.FixDateTime)

If the dates are in text format in the database, then you must create date objects in CF
with createDateTime() before you submit them to dateDiff() etc.
--
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: date difference (DateDiff) question?

2004-09-09 Thread Cornillon, Matthieu (Consultant)
> 
> 
> For some reason the dates retuned are in this format:
> Ex: "2004-09-08 12:28:56.0"
> I can't understand why it adds the ".0" after the time when the value
stored in the database is "2004-09-08 12:28:56"

 
The only thing I can think of is to try using the ParseDateTime() function
with queryTmp.Hold/ReleasedDateTime to return a good date/time object.

 
Matthieu
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]