Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


sql server date parts
Here's how to get the parts from a date on sql server:

which are the same as:

DATEPART(DAY, '1/1/2003')
DATEPART(MONTH, '1/1/2003')
DATEPART(YEAR, '1/1/2003')

To convert the date to a string, use:
CONVERT(char(10),my_date,101), where char(10) is any suitable string format (such as varchar), and 101 is any convert datetime numeric format rule. (see MSDN)

Created By: amos 4/11/2006 5:27:54 PM
Updated: 2/7/2007 3:49:26 PM