Home > Software engineering >  How to get date from datetime from database in SQL
How to get date from datetime from database in SQL

Time:11-17

This is my query to get the current date time. I don't know how to fetch only the date

SELECT SENT_TIME 
FROM APP_STATUS_WEBSERVICE 
WHERE APP_ID_EFAS = 809371

The result of this query:

enter image description here

Here it shows 22 October 2022, I just want to get the 22 only. How to do that?

I want display only date: 22

CodePudding user response:

Just use the DAY() function:

SELECT DAY(SENT_TIME) AS SENT_TIME_DAY
FROM APP_STATUS_WEBSERVICE
WHERE APP_ID_EFAS = 809371;
  •  Tags:  
  • sql
  • Related