Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Requeired Date format : 13 Sep, 2012
Requeired Date format : 13 Sep, 2012
Rate Topic
Display Mode
Topic Options
Author
Message
Minnu
Minnu
Posted Thursday, September 13, 2012 3:39 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Yesterday @ 8:34 AM
Points: 138,
Visits: 411
Hi,
am using below statement in a select statement,
" e.expiration_date" is a date fromat column,
i want the date should be displayed in 13 Sep, 2012 fromat.
case when ( rtrim(e.expiration_date)is null OR RTRIM (e.expiration_date) = '') then ''
else ' (Expires ' + rtrim(e.talent_expiration_date) + ')' end +
Please help
Post #1358433
t.brown 89142
t.brown 89142
Posted Thursday, September 13, 2012 4:51 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, November 27, 2012 9:02 AM
Points: 114,
Visits: 140
See CAST AND CONVERT
http://msdn.microsoft.com/en-us/library/ms187928(v=sql.105).aspx
There are loads of date formats available, though you may have to truncate the time portion.
You need something like
SELECT CONVERT(e.expiration_date, varchar(11), 130) AS Expiration_Date;
Post #1358467
Lynn Pettis
Lynn Pettis
Posted Thursday, September 13, 2012 7:54 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 4:33 PM
Points: 21,832,
Visits: 27,860
Skanda (9/13/2012)
Hi,
am using below statement in a select statement,
" e.expiration_date" is a date fromat column,
i want the date should be displayed in 13 Sep, 2012 fromat.
case when ( rtrim(e.expiration_date)is null OR RTRIM (e.expiration_date) = '') then ''
else ' (Expires ' + rtrim(e.talent_expiration_date) + ')' end +
Please help
I'm lost. Are you saying that the column e.expiration_date is defined as a date data type?
Now for the standard comment, you really should do your formatting of dates in the UI (User interface, application, report, etc), not in the SQL query.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #1358574
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.