Format Date in Sql 2000 (1 Viewer)

fpendino

Registered User.
Local time
Today, 15:24
Joined
Jun 6, 2001
Messages
73
Is there a quick way to format a date in SQL to return, lets say the first day of that month?

In ms access i could go Format([date],"mm/01/yyyy") and if the date = 12/15/2005, then it would return 12/01/2005.

I've looked into the Datepart function but can't get it to return the way i'm wanting. Does anyone have a user defined data type or something that may help.

Thanks!!
 

fpendino

Registered User.
Local time
Today, 15:24
Joined
Jun 6, 2001
Messages
73
Here's what I came up with. It works, but if anyone has anything better, please don't hesitate to post.


SELECT convert(varchar,convert(varchar,datepart(mm,Date))+ '/01/'+ convert(varchar,datepart(yyyy,Date)),101) AS Month
 

Users who are viewing this thread

Top Bottom