SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Requeired Date format : 13 Sep, 2012


Requeired Date format : 13 Sep, 2012

Author
Message
Minnu
Minnu
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1329 Visits: 950
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
t.brown 89142
t.brown 89142
Old Hand
Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)

Group: General Forum Members
Points: 390 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;
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)SSC Guru (92K reputation)

Group: General Forum Members
Points: 92751 Visits: 38954
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.

Cool
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)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search