Developing Matt

My Technical Journal

convert date

with 2 comments

Here is the easy way to convert a date in sql to look the way you want it to look….  select convert(varchar(8),getdate(),112)

Advertisements

Written by matt

September 4, 2007 at 8:47 am

Posted in T-Sql

2 Responses

Subscribe to comments with RSS.

  1. convert doesn’t require a lengh constraint on the varchar. and 101 will get you the full year

    convert(varchar,getdate(),101)

    other style options besides 101 and 112 can be found
    http://msdn2.microsoft.com/en-us/library/ms187928.aspx

    matt

    April 9, 2008 at 2:14 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: