how to get the date from the first date

2 views
Skip to first unread message

Niraj Kothari

unread,
Jul 29, 2021, 5:11:59 AMJul 29
to
what is the sql query to find out the full date where we put the starting date means 09/08/2020 We Only put 09. and how i will get 09/08/2020 This date

J.O. Aho

unread,
Jul 29, 2021, 8:10:34 AMJul 29
to

On 29/07/2021 11.11, Niraj Kothari wrote:
> what is the sql query to find out the full date where we put the starting date means 09/08/2020 We Only put 09. and how i will get 09/08/2020 This date

select day_column_name + "/08/2020" from table_name;

To get a whole date you have to store the whole data, change the column
type VarChar(2) to one of the following:

- Date [Format: YYYY-MM-DD, Range: '1000-01-01' to '9999-12-31']

- DateTime [Format: 'YYYY-MM-DD hh:mm:ss[.fraction]', Range: '1000-01-01
00:00:00.000000' to '9999-12-31 23:59:59.999999']

- TimeStamp [Format: 'YYYY-MM-DD hh:mm:ss[.fraction]', Range:
'1970-01-01 00:00:01.000000' to '2038-01-19 03:14:07.999999']


Then you can use DAY(date_column_name) to get the day from the
Date/DateTime/TimeStamp and DATE_FORMAT(date_column_name, '%d/%m/%Y') to
be sure to get it in the odd format you want to get it in.

--

//Aho
Reply all
Reply to author
Forward
0 new messages