year(now()) - 1 should work
~Brad
-Original Message-
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: Monday, January 08, 2007 11:30 AM
To: CF-Talk
Subject: One year behind
How do I date format a year behind the current year? In other words, I
would like to populate a dropdown
Close But not quite:
#Year(now())# (will give you 2007)
#Year(dateAdd('y',-1,now()))# (will give you 2006)
Or you can do the long way:
#DateFormat(now(), '')# (will give you 2007)
#DateFormat(dateAdd('y',-1,now()), '')# (will give you 2006)
-Original Message-
From: Orlini,
#dateAdd('y',-1,now(), )#
That is not a valid function.
You could do this.
#dateFormat(dateAdd('',-1,now()),)#
OR
Year(now()) - 1
--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
-
| 1 | |
- Binary Soduko
| | |
Robert,
Try
#Year(Dateadd('y',-1,now()))#
-Original Message-
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: Monday, January 08, 2007 11:30 AM
To: CF-Talk
Subject: One year behind
How do I date format a year behind the current year? In other words, I would
like to populate a
Also, the dateAdd function uses '' to specify year (where 'y' specifies day
of year).
So #dateAdd('y',-1,now(), )# should be #dateAdd('',-1,now(), )#.
Terry
How do I date format a year behind the current year? In other words, I
would like to populate a dropdown with 2006 and
Try supplying the full date, not just the year portion.
On 1/8/07, Orlini, Robert [EMAIL PROTECTED] wrote:
How do I date format a year behind the current year? In other words, I
would like to populate a dropdown with 2006 and 2007.
Tried this, but no dice:
#dateAdd('y',-1,now(), )#
You've got too many arguments in dateAdd. Get rid of the , part.
Cheers,
Chris
Orlini, Robert wrote:
How do I date format a year behind the current year? In other words, I would
like to populate a dropdown with 2006 and 2007.
Tried this, but no dice:
#dateAdd('y',-1,now(), )#
Terry Sta. Maria wrote:
Also, the dateAdd function uses '' to specify year (where 'y' specifies
day of year).
So #dateAdd('y',-1,now(), )# should be #dateAdd('',-1,now(),
)#.
Terry
Terry:
dateAdd only takes three arguments. Not four.
|*DateAdd*|(/datepart/, /number/,
Oops. Scratch my reply. I somehow missed the Now() portion of your
example.
On 1/8/07, Crow T. Robot [EMAIL PROTECTED] wrote:
Try supplying the full date, not just the year portion.
On 1/8/07, Orlini, Robert [EMAIL PROTECTED] wrote:
How do I date format a year behind the current year?
try using dateadd() it asks for a part, like year, and then the
offset, so you could do -1.. Should work for you
On 10/18/06, Orlini, Robert [EMAIL PROTECTED] wrote:
How can I set this to be one year behind? Right now it displays 2006; I would
like it to display 2005
cfset year =
Option 1:
cfset year = dateformat( now()-365, ) /
Option 2:
cfset year = Year( now() ) - 1 /
Agha Mehdi
IDT - eBusiness Program Manager
-Original Message-
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 18, 2006 11:45 AM
To: CF-Talk
Subject: one year
, 2006 2:53 PM
To: CF-Talk
Subject: RE: one year behind
Option 1:
cfset year = dateformat( now()-365, ) /
Option 2:
cfset year = Year( now() ) - 1 /
Agha Mehdi
IDT - eBusiness Program Manager
-Original Message-
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October
Spaces are not allowed in variable names. :)
On 10/18/06, Sandra Clark [EMAIL PROTECTED] wrote:
Doesn't account for leap years.
cfset last year = dateadd('y', -1, now())
Sandra Clark
==
http://www.shayna.com
Training in Cascading Style Sheets and
Thanks Agha and Greg
-Original Message-
From: Mehdi, Agha [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 18, 2006 2:53 PM
To: CF-Talk
Subject:RE: one year behind
Option 1:
cfset year = dateformat( now()-365, ) /
Option 2:
cfset year = Year( now() ) - 1 /
Agha
Doesn't account for leap years.
cfset last year = dateadd('y', -1, now())
Sandra Clark
Close Sandra. 'Y' if for Day of Year, '' is for year. So it should be:
cfset last year = dateAdd('', -1, now())
--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
First thing, remember to try and avoid using a function name as a variable
name.
cfset theyear = DateFormat(DateAdd(,-1,Now()),)
Second, remember that don't need the pound sign on the right side (unless
you're inside quotes).
Also, this could be done simpler like so:
cfset theyear =
To: CF-Talk
Subject: RE: one year behind
Doesn't account for leap years.
cfset last year = dateadd('y', -1, now())
Sandra Clark
Close Sandra. 'Y' if for Day of Year, '' is for year. So it should be:
cfset last year = dateAdd('', -1, now())
--
Ian Skinner
Web Programmer
And it could be done even simpler with the year() function.
~Brad
-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 18, 2006 2:25 PM
To: CF-Talk
Subject: RE: one year behind
First thing, remember to try and avoid using a function name
18 matches
Mail list logo