Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 More precise DateDiff needed
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

laser
Advanced Member

Australia
3859 Posts

Posted - 29 December 2005 :  05:55:48  Show Profile
I've developed my own add-on code (as usual), but using the Snitz functionality as much as possible. I'm using DateDiff to show the number of days between 2 dates, obviously, but it's slightly wrong.

e.g.

Comparing 1 Dec 2005, 23:00:00 with 15 Dec 2005, 01:00:00 results in a DateDiff of 14, but it's not quite 14 yet, it's more like 13.91

I'm looking at the code now, but is there any way to get a more precise DateDiff .... with decimal points would be great, or even just an "intpart" of the result.

laser
Advanced Member

Australia
3859 Posts

Posted - 29 December 2005 :  06:02:05  Show Profile
LOL @ me !!!!

It's an ASP function, not a Snitz function at all


Fixed : I dropped back to using hours, then divided by 24.


Edited by - laser on 29 December 2005 06:11:02
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 29 December 2005 :  15:08:29  Show Profile
I've still got something wrong :

As at 30 Dec 2005 07:11 -> 16 Dec 2005 23:13:01 = 14.29 days

but that's not the right answer
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 30 December 2005 :  05:13:11  Show Profile
Anyone ?
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 December 2005 :  06:41:17  Show Profile  Visit HuwR's Homepage
quote:
Originally posted by laser

I've still got something wrong :

As at 30 Dec 2005 07:11 -> 16 Dec 2005 23:13:01 = 14.29 days

but that's not the right answer


where did you get that answer ?
according to my IIS I get the difference to be
19198 mins
or 319.966666666667 hrs
or 13.3319444444444 days

where did you get 14.29 ?
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 30 December 2005 :  10:21:15  Show Profile
Yeah, I thought it would be that as well, it has to be less than 14

I'm using the code here :

http://www.v8central.com/snitz3403/penalty_reduce.asp

The "Days since last activity" is the one that is wrong, it's being calculated by (currently) :

daysMember = DateDiff("h", ChkDate(Members_ReviewDate,"",false), strForumTimeAdjust)

Then displayed as : Round(daysMember/24,2)

Remember we're talking Sydney times here, so I've added the time onto the page so you can see (bottom left corner, just above the footer).

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 December 2005 :  14:07:43  Show Profile  Visit HuwR's Homepage
Ok, from what I can work out you are probably not passing the correct times to your function, can you get it to print out the two times.

if I run these times in my function I get 11.54 days not 12.25 like you do
DateDiff("h","19 Dec 2005 17:26:54","31 Dec 2005 6:06:31") (times from your site)
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 30 December 2005 :  16:47:39  Show Profile
Yeah, I know the result I should be getting, but I think this is the problem, I've changed this :

DateDiff("h", ChkDate(Members_ReviewDate,"",false)

to this :

DateDiff("h", ChkDate(Members_ReviewDate,"",true)

Using false, it calculates from midnight
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 30 December 2005 :  21:23:57  Show Profile  Send ruirib a Yahoo! Message
I would guess the problem is indeed with ChkDate. Why don't you try to to use StrToDate instead?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 31 December 2005 :  01:15:06  Show Profile
You must have misread my last post
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07