日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯網營銷解決方案
DB2數據庫中時間函總結

本文將為您詳細介紹DB2數據庫中時間函數的分類介紹,供您參考,希望能對您有所幫助。

專注于為中小企業(yè)提供網站建設、成都網站建設服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)宜良免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯網行業(yè)人才,有力地推動了上1000+企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現規(guī)模擴充和轉變。

DB2時間函數簡單總結:

代碼
--獲取當前日期:

select current date from sysibm.sysdummy1;
values current date;

--獲取當前日期
select current time from sysibm.sysdummy1;
values current time;
--獲取當前時間戳
select current timestamp from sysibm.sysdummy1;
values current timestamp;

--要使當前時間或當前時間戳記調整到 GMT/CUT,則把當前的時間或時間戳記減去當前時區(qū)寄存器:

values current time -current timezone;
values current timestamp -current timezone;

--獲取當前年份

values year(current timestamp);

--獲取當前月
values month(current timestamp);#p#

--獲取當前日
values day(current timestamp);

--獲取當前時
values hour(current timestamp);

--獲取分鐘
values minute(current timestamp);

--獲取秒
values second(current timestamp);

--獲取毫秒
values microsecond(current timestamp);

--從時間戳記單獨抽取出日期和時間

values date(current timestamp);
values VARCHAR_FORMAT(current TIMESTAMP,"yyyy-mm-dd");
values char(current date);
values time(current timestamp);

--執(zhí)行日期和時間的計算

values current date+1 year;   
values current date+3 years+2 months +15 days;
values current time +5 hours -3 minutes +10 seconds;

--計算兩個日期之間的天數#p#

values days(current date)- days(date("2010-02-20"));

--時間和日期換成字符串

values char(current date);
values char(current time);

--要將字符串轉換成日期或時間值

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");

--計算兩個時間戳記之間的時差:

--秒的小數部分為單位
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")));
--小時為單位
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數據庫中時間函總結
標題鏈接:http://m.5511xx.com/article/dhjdjii.html