Home > Net >  Convert date into dd.mm.yyy
Convert date into dd.mm.yyy

Time:10-05

I found several questions about converting the format of date or datetime but it doesn't work. I used type datetime for 'rdate' and tried to do

SQL Convert Datetime to Date

It should be the easiest and fastest way to convert a DATETIME to a DATE and I used

SELECT CONVERT(date, rdate) FROM sreservations;

Unfortunately it isn't working.

I tried the same with the type date but I couldn't find a solution either.

Picture of the database

CodePudding user response:

From your image, you don't seem to have a datetime, just a date. You can format it (or a datetime, if you did have a datetime) into a string for display in mysql using date_format:

select date_format(rdate, '%d.%m.%Y')

if you want it to appear as dd.mm.yyyy.

CodePudding user response:

When creating your table columns which involve the column with date data type,

Use

   SET DATEFORMAT DMY

This is for Microsoft SQL server.

  • Related