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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Dates

Status
Not open for further replies.

MattSmithProg

Programmer
Joined
Sep 9, 2001
Messages
76
Location
AU
Hi,

I am trying to return some dates in a specific format. When I use

SELECT Multi, Yr, Nat,
Response_Due (Format 'DDBMMMBYYYY'),
Docs_Received (Format 'DDBMMMBYYYY'),
Further_Info_Due (Format 'DDBMMMBYYYY'),
Referred_Offline (Format 'DDBMMMBYYYY'),
Finalisation_Date (Format 'DDBMMMBYYYY'),
Finalisation_Result, Reffered_To, Pre_Finalisation,
Post_Finalisation, DWMS, UserId, Site,
Allocation (Format 'DDBMMMBYYYY'),
KeyIssues, Comments, ELS
FROM PTAPP_ACR_Main
WHERE Allocation >= '1899-12-30'
Order By Yr;

I doesn't change the format of the dates from say
2001-06-18 to 18 Jul 2001 like it should. It returns them in the same format that is on the table. It is really inportant as when the dates are placed in Excel certain dates change style. ie 6/11/2000 (6 Nov 2000) changes to 11/6/2000 (11 July 2000).

Could you please help.

Is there any other way of doing this?

Thanks

Matt
 
If we're talkin SQL Server, how about

cast(datepart(day, Response_Due) as varchar) + ' ' + cast(datename(month, datepart(month, Response_Due)) as char(3)) + ' ' + cast(datepart(year, Response_Due) as varchar) <insert witticism here>
codestorm
 
Hi Matt,

If you are in SQL the use Convert()
If it is Oracle the use ToChar()

Lookup each in the help to get the exact usage of the
format string.
hth Mike Davis
MSsql, VB and Crystal Reports Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top