Hi,

I am new with sql server. I want my date formate like dd-mm-yyyy.. but i could not able to do so.
please help me and give me proper syntex fro the same

MySQL:

select date_format(now(), '%d-%m-%Y');

PostgreSQL:

select to_char(now(), 'dd-mm-yyyy');

OracleSQL:

select to_char(sysdate, 'dd-mm-yyyy') from dual;

Clause from dual in Oracle is required, in MySQL is optional, in PG SQL not usable - raise error

Also, FWIW, the dual interface in OracleSQL is basically the internal structural tables where stuff like date/time settings (and other stuff) are stored. If you are talking about MS SQLServer, that is basically Sybase massively altered by Microsoft. You would need to read their documentation to determine how to do what you want.

I'm using SQL Server and used this function to get the format like dd-mm-yyyy.

select FORMAT(GETDATE(),'dd-MM-yyy')

@Bhavini_2

for sql:" SELECT FORMAT (getdate(), 'dd-MM-yyyy') " this syntex works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.