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


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


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


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')


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.