I want to get date in dd/mon/yyyy
format ie 28/apr/2015
select Birth_DATE
from dbo.customer
where Birth_DATE
is of datetime
type. I have looked at all inbuilt convert
types but nothing helped for me.
use CONVERT
with style 106
and REPLACE
the space like this.
SELECT REPLACE(CONVERT(VARCHAR(30),GETDATE(),106),' ','/')
Your query would be
select REPLACE(CONVERT(VARCHAR(30),Birth_DATE,106),' ','/') from dbo.customer
In General:
select cast(day(getdate()) as varchar(2))+'/'+ left(datename(mm,getdate()),3)+'/'+cast(year(getdate()) as varchar(4))
Your Code:
select cast(day(Birth_DATE) as varchar(2))+'/'+ left(datename(mm,Birth_DATE),3)+'/'+cast(year(Birth_DATE) as varchar(4)) from dbo.Customer
Syntax: CONVERT(data_type(length),expression,style)
For your format: CONVERT(VARCHAR(11),GETDATE(),106)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.