Advertisement

mysql提取不同时间的数据方法

阅读量:

1.提取数据的年月日(eg:2018-06-21)

METHOD 1: The substring function extracts the first ten characters from the time string starting at position one.

METHOD 2: The date function returns the basic components of the time value.

METHOD 3: Using a formatted date, we can display the time in 'YYYY-MM-DD' format.

METHOD 4: This method retrieves the first ten characters of the time string.

2.提取数据的年月(eg:2018-06)

方法1:SUBSTR(time FROM 1 FOR 7);

方法2:DATE_FORMAT(time,'%Y-%m');

方法3:LEFT(time,7);

3.提取数据的日期(eg:21)

方法1:SUBSTR(time FRO

全部评论 (0)

还没有任何评论哟~