<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?

<cfset yearAhead = DateAdd( "yyyy", 1, Now() ) />

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

<cfoutput>
#dateFormatted#
</cfoutput>
commented: 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 ;)

commented: Good way to teach a person!!! +1

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.

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.

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.

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 ;)

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

Thanks to all of you!!!!

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.

commented: Not a very useful first post here. -3

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.