Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long Month Names in Date

Status
Not open for further replies.

homeskillet

IS-IT--Management
Jan 17, 2002
6
US
I'm hoping someone else has already done this...it seems like it would be common.

I am trying to get a date to print out as January XX, 2002. The closest format I can find in SQL 2000 is Jan. XX, 2002.

This is basically for a letter that prints out a due-date...i.e. "You have ten days to pay up. If we do not receive your payment by January 10, 2002, we'll come and get you."

Any help is greatly appreciated.
 
Usually it is common to use a report writer or a word processor to produce form letters. Every one I have ever used includes functions to convert date formats.

SQL Server on the other hand is a client server database not a report writer or a database, it is not logical to expect it to cover converting dates to all formats.
 
Point taken...but one might think that it would be logical for it to be at least capable of producing one of the most common date formats. I mean...it already "almost" does it.

The problem is that the "report writer" we have to use can only accept fields passed from SQL; this particular problem stemming from the need to add nine days from the date of the letter (which the report writer does just fine on its own). We currently do it now by requiring the user to manually enter some information after the report receives the SQL data.

So, if you have any ideas that could help me make it so that no interaction is needed, I sure would love to hear them.
 
Thanks tlbroadbent...I had overlooked that previously and your tip kind of cleared my mind. So, it works now with the following syntax (more than I had wanted to type, but that's what we get paid for, right?)So...my problem was having to add the days to each of the dateparts, and it appears to work fine. If you notice anything that is going to bite me later, feel free to let me know. Thanks again.


convert(varchar(8),datename(mm,datepart(mm,dateadd(dd, 9, getdate())))) + ' ' +
convert(varchar(2),datepart(dd,dateadd(dd, 9, getdate()))) + ', ' +
convert(varchar(4),datepart(yy, dateadd(dd, 9, getdate()))) AS DueDate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top