Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.mysql > #7580

Re: how to get the date from the first date

From "J.O. Aho" <user@example.net>
Newsgroups comp.databases.mysql
Subject Re: how to get the date from the first date
Date 2021-07-29 14:10 +0200
Message-ID <imfk5oFii61U1@mid.individual.net> (permalink)
References <b62ae77e-1dbf-42e3-9d9c-9d2b904043d4n@googlegroups.com>

Show all headers | View raw


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

Back to comp.databases.mysql | Previous | NextPrevious in thread | Find similar


Thread

how to get the date from the first date Niraj Kothari <niraj.kothari@abmra.in> - 2021-07-29 02:11 -0700
  Re: how to get the date from the first date "J.O. Aho" <user@example.net> - 2021-07-29 14:10 +0200

csiph-web