Tuesday, May 6, 2014

SQL Format Function


If you need a date/time in a format other than the standard ones covered by the CONVERT function, try out the FORMAT function:

FORMAT(@SomeDateTime'yyyy-MM-dd'AS FormattedDateTime

This will turn a date/time like "2014-04-24 14:38:13.0000000" into "2014-04-24".

No comments:

Post a Comment

Please only include comments that add to the substance of the Blog Post:
- Question or request for clarification
- Idea for improvement
- Identifying an issue

Please refrain from promotion.