سؤال

I am trying to find out how to change my get date into the format of ccmmdd?

So far the closest iv come is ccyymmdd with:

CONVERT(VARCHAR(8),GETDATE(),112)

This produces 20140505, What i'm looking for is 140505.

Is there a link i can follow to see the different sql date formats, or would this be best done through string manipulation?

هل كانت مفيدة؟

المحلول

Try this:

CONVERT(VARCHAR(8),GETDATE(),12)

The list of available formats can be found here:

http://msdn.microsoft.com/en-us/library/ms187928.aspx

نصائح أخرى

This also works.

RIGHT(CONVERT(VARCHAR(10),GETDATE(),112),6)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top