convert date to format ddmmyyyy

hi experts
i need convert datat type date to dd.mm.yyyy

CREATE TABLE [dbo].[days](
      [PKDate] [date] NOT NULL,
      [calendar_year] [smallint] NULL,


select PKDate
from days dy
where dy.calendar_year = '2015'

2015-01-01
2015-01-02
2015-01-03
2015-01-04
2015-01-05
enrique_aeoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun KlineLead Software EngineerCommented:
Use the CONVERT function along with the REPLACE function:
REPLACE(CONVERT(varchar(10), PKDate, 103), '/', '')

MSDN Convert Page lists other formats for the convert function.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
Enrique you need to be more clear with your questions and examples.
For example, you defined calendar_year as smallint but in WHERE clause you're using a string ("where dy.calendar_year = '2015'").

And what's this? Is the current result or what you're expecting?
2015-01-01
2015-01-02
2015-01-03
2015-01-04
2015-01-05

If is what you're expecting, what are the current results?
If is the current results, what are you expecting as output?
0
enrique_aeoAuthor Commented:
select '2015', dy.calendar_week_in_year, min(REPLACE(CONVERT(varchar(10), PKDate, 103), '/', '.'))
from days dy
where dy.calendar_year = '2015'
group by dy.calendar_week_in_year
0
enrique_aeoAuthor Commented:
2015      1      01.01.2015
2015      2      04.01.2015
2015      3      11.01.2015
2015      4      18.01.2015
2015      5      25.01.2015
2015      6      01.02.2015
2015      7      08.02.2015
2015      8      15.02.2015
2015      9      22.02.2015
2015      10      01.03.2015
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.