horaedb icon indicating copy to clipboard operation
horaedb copied to clipboard

Should we support `Date` type?

Open Rachelint opened this issue 3 years ago • 3 comments

Describe This Problem

Date is a common type in database, should we support it ? Every row here must contain timestamp, Date type seems a bit redundant, but some information(such as birthday) seems more appropriate to express by Date?

Proposal

  • Use i32/i64 to store date32/date64 like arrow.
  • Add necessary conversions like other defined types.
  • Format it in response.

Additional Context

No response

Rachelint avatar Aug 15 '22 01:08 Rachelint

It is great if Date is supported, and we can leave this feature for volunteers in the community.

ShiKaiWi avatar Aug 16 '22 12:08 ShiKaiWi

I am try. pls assign me.

impactCn avatar Sep 08 '22 08:09 impactCn

I am try. pls assign me.

The proposal is a little bit simple, and any discussion is welcome when you have any difficulty in implementing this feature.

ShiKaiWi avatar Sep 08 '22 09:09 ShiKaiWi

  1. A date. The supported range is '1000-01-01' to '9999-12-31'. MySQL displays DATE values in 'YYYY-MM-DD' format.See:https://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-syntax.html
  2. But permits assignment of values to DATE columns using either strings or numbers. like: STR_TO_DATE,SUB_DATE,See:https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_str-to-date

MichaelLeeHZ avatar Nov 11 '22 01:11 MichaelLeeHZ

@MachaelLee

But permits assignment of values to DATE columns using either strings or numbers

For such conversion, I guess we already have an example for that -- converting string date literal to timestamp literal.

ShiKaiWi avatar Nov 11 '22 02:11 ShiKaiWi

@MachaelLee

But permits assignment of values to DATE columns using either strings or numbers

For such conversion, I guess we already have an example for that -- converting string date literal to timestamp literal.

It is not common that converting string date literal to timestamp literal. Usually we convert timestamp to date with cast( timestamp as date); sometimes we convert date to unixtimetamp with UNIX_TIMESTAMP(), it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC.

MichaelLeeHZ avatar Nov 11 '22 03:11 MichaelLeeHZ