Yep, I noticed that. The example in the docs is wrong.

--- Ben



-----Original Message-----
From: Steve Oliver [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 05, 2002 9:27 PM
To: CF-Talk
Subject: RE: Bug in CF 5's FirstDayOfMonth?


Yeah I get it, but whoever wrote the CF documentation didn't :)

That was straight from the examples that come with CF Studio
______________________ steve oliver atnet solutions, inc.
http://www.atnetsolutions.com


-----Original Message-----
From: Ben Forta [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 05, 2002 8:39 PM
To: CF-Talk
Subject: RE: Bug in CF 5's FirstDayOfMonth?


FirstDayOfMonth() returns an ordinal number, the day in year. So
FirstDayOfMonth() for January returns 1, for February it'll always
return 32, for March it'll depend on whether it is a leap year (and
February would then have an extra day). You are using
FirstDayOfMonth(Now()), and as we are in February you are getting the
value 36, just as you would every February 5th.

The value that DayOfWeek() expects is a date time object, not an ordinal
date. If you pass an ordinal value to it then you'll get odd values, or
rather, the same value for every year for February 5th in particular.

To do what you are trying to do you need to convert the ordinal date to
a real date, use DateAdd() to add that many days to Jan 1st (that many
days - 1, actually) and it should do what you want.

--- Ben





-----Original Message-----
From: Steve Oliver [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 05, 2002 8:21 PM
To: CF-Talk
Subject: Bug in CF 5's FirstDayOfMonth?


I was playing with FirstDayOfMonth to figure out the first day of
February, which should be Friday.  Using the example that comes with the
CF5 documentation, which is the following.

<cfoutput>
The first day of #MonthAsString(Month(Now()))#, 
 #Year(Now())# was 
  a #DayOfWeekAsString(DayOfWeek(FirstDayOfMonth(Now())))#,
   day #FirstDayOfMonth(Now())# of the year.
</cfoutput>


Everytime I run that snippet, it says the first day of February is
Wednesday?

______________________
steve oliver
atnet solutions, inc.
http://www.atnetsolutions.com




______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to