On Mon, 25 Oct 2004 16:38:13 +0100, James Smith  wrote:
> OK, I am sure I am doing something stupid here, but if I simply output the
> following to the browser, it displays 31...
> 
> #daysinmonth(month(dateadd("m",-1,now())))#
> 
> Last time I checked September only had 30 days.  If I output....
> 
> #month(dateadd("m",-1,now()))#

The issue is that you're passing the number of the month into the
daysinmonth function, which is expecting a date. So, instead of
passing in 25-Sep-2004 into the function, you're passing the number 9
into it.  I'm assuming that it's interpreting that as the 9th day of
the year, which would be in January, which has 31 days.

Change it to:
#daysinmonth(dateadd("m",-1,now()))#

and you'll get 30.

Scott
-- 
-----------------------------------------
Scott Brady
http://www.scottbrady.net/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Sams Teach Yourself Regular Expressions in 10 Minutes  by Ben Forta 
http://www.houseoffusion.com/banners/view.cfm?bannerid=40

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182502
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