Forum

Can you give some e...
 
Share:
Notifications
Clear all

Can you give some examples using SQL date format dd mm yyyy?


kumar BI
Posts: 18
 kumar BI
Topic starter
(@kumar BI)
Joined: 2 years ago

how to use sql date format dd mm yyyyy or sql date format yyyymmdd

2 Replies
Kassimou
Posts: 1
(@idrissou)
New Member
Joined: 2 years ago

select last_name, hire_date

from employees

where to_char(hire_date,'yyyy') >2005

Reply



VK
Posts: 18
 VK
(@vinodkrsetty5895)
Active Member
Joined: 2 years ago

Let us consider the simple calendar table for this example SQL date format dd mm yyyy and date format YYYYMMDD examples.

 

date format ddmmyyyy

 

Calander

date
25-02-20200000

 

Select FORMAT(date,'dd-MM-yyyy') from calendar

 

Here date is a column name in the calendar table

 

It returns date something like 25-02-2020 for date format ddmmyyyy.

 

Select FORMAT(date,'yyyy-MM-dd') from calendar

Returns 2020-02-25 for date format yyyymmdd

 

I can also ignore a specific format something like below.

 

Select FORMAT(date,'yyyy-MM') from calendar

 

Returns 2020-02

Reply

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: