Forum

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

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


Posts: 18
Guest
Topic starter
(@kumar BI)
Active Member
Joined: 4 years ago

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

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

select last_name, hire_date

from employees

where to_char(hire_date,'yyyy') >2005

Reply

Self Learning Video Tutorials - Software Course

Posts: 18
 VK
(@vinodkrsetty5895)
Active Member
Joined: 4 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-2020:00:00:0000

 

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: