mysql獲取當(dāng)月第一天 MYSQL中獲取當(dāng)前的年和月?
MYSQL中獲取當(dāng)前的年和月?使用todays函數(shù)選擇todays(now())-todays(“19930908”)使用DateDiff函數(shù)mysql如何獲取當(dāng)前時(shí)間?1.1獲取當(dāng)前日期時(shí)間函數(shù):n
MYSQL中獲取當(dāng)前的年和月?
使用todays函數(shù)
選擇todays(now())-todays(“19930908”)
使用DateDiff函數(shù)
mysql如何獲取當(dāng)前時(shí)間?
1.1獲取當(dāng)前日期時(shí)間函數(shù):now()
除了now()函數(shù)獲取當(dāng)前日期時(shí)間之外,MySQL中有以下函數(shù):
current imestamp()current這些日期時(shí)間函數(shù)等價(jià)于now()。由于now()函數(shù)很短而且容易記住,因此建議您始終使用now()而不是上面列出的函數(shù)。
1.2獲取當(dāng)前日期時(shí)間函數(shù):sysdate()
sysdate()日期時(shí)間函數(shù)類似于now(),區(qū)別在于now()的值是在執(zhí)行開始時(shí)獲取的,sysdate()的值是在函數(shù)執(zhí)行過程中動(dòng)態(tài)獲取的。
2. 獲取當(dāng)前日期函數(shù):current()
其中以下兩個(gè)日期函數(shù)等效于current():currentudate(),currentuget the current time函數(shù):current()],其中,以下兩個(gè)時(shí)間函數(shù)等效于current():currentutime(),currentuget當(dāng)前UTC日期時(shí)間函數(shù):UTCudate(),UTCutime(),UTCutimestamp()