The reason is how dates are stored. Dates are stored as sequential numbers. You are passing the sequential number 5 into the routine which Dateformat thinks is something weird like 1/4/0001 or some such weird number.
You need to pass the true datetime variable. Date format will only return the day portion anyhow, you don't need to pull the day out before formatting it. ______________________________________________________ Bill Grover Supervisor MIS Phone: 301.424.3300 x3324 EU Services, Inc. FAX: 301.424.3696 649 North Horners Lane E-Mail: [EMAIL PROTECTED] Rockville, MD 20850-1299 WWW: http://www.euservices.com ______________________________________________________ > -----Original Message----- > From: Phillip Broussard [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 05, 2002 11:33 AM > To: CF-Talk > Subject: RE: whats wrong with DateFormat() > > > I can understand why the number 5 may not work but when I use > DateFormat(day(now()), 'dd') I still get a date of yesterday. > This just > doesn't seem right. > > Phillip > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, March 05, 2002 10:25 AM > > To: CF-Talk > > Subject: Re: whats wrong with DateFormat() > > > > The function day() returns a simple number between 1 and 31. It > > > > expects a date/time object. The number "5" is a date/time object, > > but > > > > it doesn't represent the day "4". > > > > The function dateformat expects a date/time object, a string that > looks > > > > > > like a date, or a numeric representation of a date object. > I guess t > > he > > > > number "5" has a day of "4". > > > > > > > > ----- Original Message ----- > > From: Phillip Broussard <[EMAIL PROTECTED]> > > Date: Tuesday, March 5, 2002 9:15 am > > Subject: whats wrong with DateFormat() > > > > > Ok I put DateFormat(day(now()), 'dd') on a page and instead of > > > > > returning05 it gave me 04. > > > > > If I put day(now()) on a page I get 5. > > > If I put day(5) on a page I get 4. > > > If I put DateFormat(now(), 'yyyymmdd') on a page I get 20020305 > > > > > > > > > > Why? > > > > > > > > > > TAI > > > > > > > > Phillip Broussard > > > Tracker Marine Group > > > 417-873-5957 > > > > > > > > > > > > > _______________________ > > _________________________ > > ______________________ > > > Dedicated Windows 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=coldfusiona > > > > > 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?sideb > > ar=lists > > > > > > ______________________________________________________________________ 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/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

