Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to Change Date Format to dd/mm/yyyy (Example: 28/10/2022)

Hello, I want to ask. I'm a SQL Server Express 2017 user. I want to ask, how do I change the date format in the system (not in SQL) to dd/mm/yyyy (Example: 28/10/2022)? If using the Windows Operating System, this can be done in regional settings:

Screenshot_4.jpg

 

 

 

 

 

 

 

 

But, in Cloud SQL I don't know how. If anyone knows please let me know, because I really need it. Thanks. God bless you.

0 4 13.8K
4 REPLIES 4

RC1
Bronze 4
Bronze 4

@laburakab I don't think we are able to change the system date format in mysql (cloud sql) server , but why do you want it ? What usecase are you trying to solve ? Normally we use date format related functions for this => https://www.w3schools.com/sql/func_mysql_date_format.asp

Hi @laburakab

If you want to show the date format in the SQL 

 

 select convert(varchar(max), DateColumn,  13), 
        format(DateColumn, 'dd-MMM-yyyy')
 from MyTable

 

 

A DATE column does not have a format. You cannot specify a format for it.

The date types are chosen for a column when you create a new table in your database, see.

You can use DateStyle to control how SQL Server emits dates, but it's global and a bit limited.

Instead, you should use to_char to format the date when you query it, or format it in the client application. Like:

SELECT to_char("date", 'DD/MM/YYYY') FROM mytable;

e.g.

regress=> SELECT to_char(DATE '2014-04-01', 'DD/MM/YYYY');
to_char
------------
01/04/2014
(1 row)

 

tengo el mismo problema importe una base de datos de un sistema que esta ya en produccion y el aplicativo que utiliza la base de datos no funciona porque pide que el formato de fachas el servidor lo trabaje en dd/mm/yyyy y el servidor lo esta manejando como yyyy/mm/dd que se puede hacer porque en un servidor local lo soluciono cambiando el formato en las propiedades pero aqui no se permite