0

<cfoutput>
#DateFormat(Now(), "mmm-dd-yyyy")#<br>
</cfoutput>

the result is:

Jul-09-2009

What i wanted to do is....to add 1 year from todays date or
I want to show a date that is a year after. Is thare a cf tag that will help me do that? is that possible? Do i need to use a language outside coldfusion?

4
Contributors
10
Replies
14
Views
7 Years
Discussion Span
Last Post by arrgh
1
<cfset yearAhead = DateAdd( "yyyy", 1, Now() ) />

<cfset dateFormatted = DateFormat( yearAhead, "mmm-dd-yyyy" ) />

<cfoutput>
#dateFormatted#
</cfoutput>
Votes + Comments
Good thought
1

I didn't think the documentation was that cryptic. But then I'm more of a "teach a man to fish ..." kind of person ;)

Votes + Comments
Good way to teach a person!!!
0

Thanks Samaru! , and Arrgh!

I thought I did the right thing in updating the date to 1 year ahead. What I did was instead of DateFormat code, I did the TimeFormat code.

Both of you helped me a lot. I am now doing my personal web. It's nothing in there yet but hopefully when i come up with a good idea on what to put there, i will let you both look at it.

I would be happy to get your feedback once you see my coldfusion website.

0

I thought I did the right thing in updating the date to 1 year ahead. What I did was instead of DateFormat code, I did the TimeFormat code.

I'm not sure what you mean. Neither of those functions perform date math. They only format values for output. Also, TimeFormat() is used for formatting time values, not dates.

0

Well, the first code that i used was timeFormat. this code gave me the wrong result which gave me an idea to start this thread.

then you gave me a link that led me to a site and found out that the code that i used was for the time. if i want to add 1 year to my date then i have to use the dateformat.

then samaru posted a code that confirmed my thought. so i would just like to thank you.

0

Ah, ok. But just to keep things straight, the DateAdd() function is what's actually adding 1 year to your date. DateFormat() doesn't do anything but make the value pretty ;)

0

yep,
DateFormat(DateAdd(yyyy, 1, date))

Thanks to all of you!!!!

-1

arrgh, Don't let us catch you asking for code on any forum. We'll just send you directly to the documentation. if someone asks for help and code, just give it to them.

Votes + Comments
Not a very useful first post here.
0

paulbaylis1

You seem to need a few lessons in learning how to communicate with others. Every one else here managed to remain civil, and take the comments in friendly manner in which they were intended. Except you. While you can certainly express your opinions, you can't tell other people what to do. One would hope your coding skills are not as limited as your social skills appear to be. If not, I don't think you'll have to worry about anyone asking for your advice.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.