新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
DB2時(shí)間函數(shù)大全
DB2時(shí)間函數(shù)是我們最常見(jiàn)的函數(shù)之一,下面就為您介紹一些DB2時(shí)間函數(shù),供您參考,希望可以讓您對(duì)DB2時(shí)間函數(shù)有更多的了解。

成都創(chuàng)新互聯(lián)公司專(zhuān)注于網(wǎng)站建設(shè)|成都網(wǎng)站維護(hù)公司|優(yōu)化|托管以及網(wǎng)絡(luò)推廣,積累了大量的網(wǎng)站設(shè)計(jì)與制作經(jīng)驗(yàn),為許多企業(yè)提供了網(wǎng)站定制設(shè)計(jì)服務(wù),案例作品覆蓋成都木包裝箱等行業(yè)。能根據(jù)企業(yè)所處的行業(yè)與銷(xiāo)售的產(chǎn)品,結(jié)合品牌形象的塑造,量身制作品質(zhì)網(wǎng)站。
- --獲取當(dāng)前日期:
- select current date from sysibm.sysdummy1;
- values current date;
- --獲取當(dāng)前日期
- select current time from sysibm.sysdummy1;
- values current time;
- --獲取當(dāng)前時(shí)間戳
- select current timestamp from sysibm.sysdummy1;
- values current timestamp;
- --要使當(dāng)前時(shí)間或當(dāng)前時(shí)間戳記調(diào)整到 GMT/CUT,則把當(dāng)前的時(shí)間或時(shí)間戳記減去當(dāng)前時(shí)區(qū)寄存器:
- values current time -current timezone;
- values current timestamp -current timezone;
- --獲取當(dāng)前年份
- values year(current timestamp);
- --獲取當(dāng)前月
- values month(current timestamp);
- --獲取當(dāng)前日
- values day(current timestamp);
- --獲取當(dāng)前時(shí)
- values hour(current timestamp);
- --獲取分鐘
- values minute(current timestamp);
- --獲取秒
- values second(current timestamp);
- --獲取毫秒
- values microsecond(current timestamp);
- --從時(shí)間戳記單獨(dú)抽取出日期和時(shí)間
- values date(current timestamp);
- values VARCHAR_FORMAT(current TIMESTAMP,'yyyy-mm-dd');
- values char(current date);
- values time(current timestamp);
- --執(zhí)行日期和時(shí)間的計(jì)算
- values current date+1 year;
- values current date+3 years+2 months +15 days;
- values current time +5 hours -3 minutes +10 seconds;
- --計(jì)算兩個(gè)日期之間的天數(shù)
- values days(current date)- days(date('2010-02-20'));
- --時(shí)間和日期換成字符串
- values char(current date);
- values char(current time);
- --要將字符串轉(zhuǎn)換成日期或時(shí)間值
- values timestamp('2010-03-09-22.43.00.000000');
- values timestamp('2010-03-09 22:44:36');
- values date('2010-03-09');
- values date('03/09/2010');
- values time('22:45:27');
- values time('22.45.27');
- --計(jì)算兩個(gè)時(shí)間戳記之間的時(shí)差:
- --秒的小數(shù)部分為單位
- values timestampdiff(1,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --秒為單位
- values timestampdiff(2,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --分為單位
- values timestampdiff(4,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --小時(shí)為單位
- values timestampdiff(8,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --天為單位
- values timestampdiff(16,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --周為單位
- values timestampdiff(32,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --月為單位
- values timestampdiff(64,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --季度為單位
- values timestampdiff(128,char(current timestamp - timestamp('2010-01-01-00.00.00')));
- --年為單位
- values timestampdiff(256,char(current timestamp - timestamp('2010-01-01-00.00.00')));
【編輯推薦】
DB2公共表表達(dá)式的用法
跨數(shù)據(jù)庫(kù)訪問(wèn)DB2表的方法
DB2表空間大小的限制
深入解讀DB2存儲(chǔ)過(guò)程
DB2連接服務(wù)器的配置
網(wǎng)頁(yè)題目:DB2時(shí)間函數(shù)大全
網(wǎng)站鏈接:http://fisionsoft.com.cn/article/dppcocj.html


咨詢(xún)
建站咨詢(xún)
