Re: how to get the date from the first date
"J.O. Aho" <[email protected]> Thu, 29 Jul 2021 14:10:31 +0200
| Newsgroups | comp.databases.mysql |
|---|---|
| Message-ID | <[email protected]> |
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