yiguolei commented on code in PR #998:
URL: https://github.com/apache/doris-website/pull/998#discussion_r1716279274


##########
docs/sql-manual/sql-data-types/date-time/datetime-overview.md:
##########
@@ -24,11 +24,46 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+### Description
 
+Date types include DATE, TIME and DATETIME, DATE type only stores the date 
accurate to the day, DATETIME type stores the date and time, which can be 
accurate to microseconds. TIME type only stores the time, and **does not 
support the construction of the table storage for the time being, can only be 
used in the query process**.
 
+### Calculation and Type Convertion
 
-The date data types include DATE and DATETIME:
+When performing mathematical calculations on a date type, the date type will 
be converted to the corresponding numeric type (e.g. BIGINT, DOUBLE, etc.). The 
conversion is similar to number splicing, see the example below:
 
-- **[DATE](../datetime/DATE.md)**: It stores only the date. The minimum 
precision unit is days.
+```sql
+mysql> select cast('2020-12-12' as date)*1;
++----------------------------------------------------+
+| (cast(cast('2020-12-12' as DATEV2) as BIGINT) * 1) |
++----------------------------------------------------+
+|                                           20201212 |
++----------------------------------------------------+
+1 row in set (0.12 sec)
 
-- **[DATETIME](../datetime/DATETIME.md)**: It stores both the date and time. 
The minimum precision unit is milliseconds.
\ No newline at end of file
+mysql> select cast('2020-12-12 05:10:32.123456' as datetime(6))*1;
++---------------------------------------------------------------------------+
+| (cast(cast('2020-12-12 05:10:32.123456' as DATETIMEV2(6)) as BIGINT) * 1) |
++---------------------------------------------------------------------------+
+|                                                            20201212051032 |

Review Comment:
   也就是说 datetime 类型cast 到int的时候是保留到秒?
   我们得有这个测试,确保这个行为不发生变化



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to