Josh
Josh

Reputation: 157

SQL Cast Date as DDMMMYYYY

I was previously using:

Left(replace(cast(TICKET_EXPIRATION_DATE as varchar(10)), ''-'', ''''),9)

But I need to change the format of the date to be DDMMMYYYY. Any suggestions?

Thanks!

Upvotes: 1

Views: 395

Answers (1)

MatBailie
MatBailie

Reputation: 86735

Assuming SQL Server, and that your original datatype is one of the DATE datatypes...

REPLACE(CONVERT(VARCHAR(11), TICKET_EXPIRATION_DATE, 106), ' ', '')

http://sqlfiddle.com/#!18/0f5b0/7

Upvotes: 2

Related Questions