欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL 日期時間函數(shù)常用總結(jié)

 更新時間:2012年06月12日 17:30:56   作者:  
MySQL 日期時間函數(shù)常用總結(jié),需要的朋友可以參考下

 獲得當(dāng)前日期+時間(date + time)1.1    函數(shù):now()

     相關(guān)函數(shù):current_timestamp(),localtime(),localtimestamp()

     舉例說明:



        2. 獲得當(dāng)前日期(date)

     函數(shù):curdate()

     相關(guān)函數(shù):current_date(),current_date

     舉例說明:



        3. 獲得當(dāng)前時間(time)

    函數(shù):curtime()

     相關(guān)函數(shù):current_time(),current_time

    舉例說明


     

        4. MySQL dayof… 

    函數(shù):dayofweek(), dayofmonth(), dayofyear()分別返回日期參數(shù),在一周、一月、一年中的位置。

    舉例說明

    set @dt = '2008-08-08';

    select dayofweek(@dt); -- 6

    select dayofmonth(@dt); -- 8

    select dayofyear(@dt); -- 221

    日期‘2008-08-08′ 是一周中的第6 天(1 = Sunday, 2 = Monday, …, 7 = Saturday)

    一月中的第8 天;一年中的第221 天

    相關(guān)文章

    最新評論