Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Requeired Date format : 13 Sep, 2012 Expand / Collapse
Author
Message
Posted Thursday, September 13, 2012 3:39 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, December 4, 2014 4:34 AM
Points: 233, Visits: 739
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
Posted Thursday, September 13, 2012 4:51 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-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
Posted Thursday, September 13, 2012 7:54 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 10:16 AM
Points: 20,860, Visits: 32,884
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 »

Add to briefcase

Permissions Expand / Collapse