August 14, 2013 at 1:59 pm
Dear friends,
I have date field in the date time stamp format as shown-
Create Date
2012-06-21 07:01:03.000
I need to display it in the report as -
Format as DD-MMM-YYYY, e.g., 21-Sep-2013
Need help on this please.
Kind Regards
Dhananjay
August 14, 2013 at 2:07 pm
SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY]
August 14, 2013 at 2:43 pm
Thanks so much it worked.
August 14, 2013 at 2:53 pm
Ideally you should leave the formatting to the front end instead of pulling it from sql. If you look at BOL you will find many formats for convert to format datetime values.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 14, 2013 at 7:10 pm
dhananjay.nagarkar (8/14/2013)
Thanks so much it worked.
Just don't ever store that in a permanent table. You will learn to hate yourself if you do. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply