Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Enterprise
Expertise: Advanced
Apr 12, 2002

Format the Given Date into a Required Date Format


You can change the given format into the required date format using the CONVERT Function. Here's an example:
 
companyid   peo
----------- -----------
104         1998-09-30
104         1999-09-30
104         1999-12-31
104         2000-03-31
104         2000-06-30
104         2000-09-30
104         2000-12-31
104         2001-03-31
104         2001-06-30
104         2001-09-30

(10 row(s) affected)
'///////////////////////////////////

select distinct companyid ,CONVERT(char(10) , peo ,101) Style1,
CONVERT(char(10) , peo ,103) Style2 from fintabdatamin where 
companyid=104

companyid   Style1     Style2
----------- ---------- ----------
104         09/30/1998 30/09/1998
104         09/30/1999 30/09/1999
104         09/30/2000 30/09/2000
104         09/30/2001 30/09/2001
104         03/31/2000 31/03/2000
104         06/30/2001 30/06/2001
104         03/31/2001 31/03/2001
104         12/31/1999 31/12/1999
104         06/30/2000 30/06/2000
104         12/31/2000 31/12/2000

(10 row(s) affected)
Somaiah Manukonda
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date