得到當(dāng)前時(shí)間的年份、月份、天、小時(shí)等等:
YEAR (current timestamp) MONTH (current timestamp) DAY (current timestamp) HOUR (current timestamp) MINUTE (current timestamp) SECOND (current timestamp) MICROSECOND (current timestamp)
分別得到當(dāng)時(shí)的日期和時(shí)間
DATE (current timestamp) TIME (current timestamp)
關(guān)于時(shí)間的一些計(jì)算:
current date + 1 YEAR current date + 3 YEARS + 2 MONTHS + 15 DAYS current time + 5 HOURS - 3 MINUTES + 10 SECONDS
計(jì)算兩個(gè)日期之間有多少天:
days (current date) - days (date(’1999-10-22′))
得到去除毫秒的當(dāng)前時(shí)間:
CURRENT TIMESTAMP - MICROSECOND (current timestamp) MICROSECONDS
將時(shí)間轉(zhuǎn)換成字符串:
char(current date) char(current time) char(current date + 12 hours)
將字符串轉(zhuǎn)換成時(shí)間:
TIMESTAMP (’2002-10-20-12.00.00.000000′) TIMESTAMP (’2002-10-20 12:00:00′) DATE (’2002-10-20′) DATE (’10/20/2002′) TIME (’12:00:00′) TIME (’12.00.00′)
|