当前位置:网站首页>Kingbasees plug-in KDB of Jincang database_ date_ function
Kingbasees plug-in KDB of Jincang database_ date_ function
2022-07-03 04:22:00 【Thousands of sails passed by the side of the sunken boat_】
1. kdb_date_function Introduce
kdb_date_function It's a compatible mysql database date Extension of correlation function .
You need to create extension kdb_date_function, When you don't need to drop extension kdb_date_function that will do .
2. date_add
date_add — Realize the addition of dates
grammar :
date_add(ts timestamp, iv interval) return timestamp. date_add(tstz timestamptz, iv interval) return timestamptz.
describe :
date_add Will come true timestamp or timestamptz And interval Perform the operation of addition .
Parameters :
iv
Used in date addition operation interval Type values .
ts
Used in date addition operation timestamp Type values .
tstz
Used in date addition operation timestamptz Type values .
Return value :
Return the specific date type value after calculation .
annotation :
give an example :
select date_add('2000-10-10'::timestamp,interval '1 year'); date_add -------------------------- Wed Oct 10 00:00:00 2001 (1 row) select date_add('2010-10-10 12:00:00'::timestamp,interval '1 year 1 day 2 hour'); date_add -------------------------- Tue Oct 11 14:00:00 2011 (1 row)
3. dateadd
dateadd — Realize the addition of dates
grammar :
dateadd(i_unit text, i_value numeric, i_date time) return time.
dateadd(i_unit text, i_value numeric, i_date timestamp) return timestamp.
dateadd(i_unit text, i_value numeric, i_date timestamptz) return timestamptz.
describe :
Realization timestamp or timestamptz or time Type is added to the specified format .
Parameters :
i_unit
Specify what to add i_value The format of .
i_value
Specify the quantity to add .
i_date
Specify the date to be added .
Return value :
Return the specific date type value after calculation .
annotation :
i_unit The value of can make 'second','minute','hour','day','week','month','year' etc. .
give an example :
SELECT dateadd(year,9998,'0001-01-01 00:00:00'::timestamptz); dateadd ------------------------------ Fri Jan 01 00:00:00 9999 PST (1 row) SELECT dateadd(year,201,'1900-01-01 00:00:00'::timestamptz); dateadd ------------------------------ Sat Jan 01 00:00:00 2101 PST (1 row) SELECT dateadd(year,30,'1970-01-01 00:00:00'::timestamptz); dateadd ------------------------------ Sat Jan 01 00:00:00 2000 PST (1 row) SELECT dateadd(year,-9998,'9999-12-31 00:00:00'::timestamptz); dateadd ------------------------------ Mon Dec 31 00:00:00 0001 PST (1 row) SELECT dateadd(year,-100,'2000-12-31 00:00:00'::timestamptz); dateadd ------------------------------ Mon Dec 31 00:00:00 1900 PST (1 row) SELECT dateadd(year,-34,'2004-12-31 00:00:00'::timestamptz); dateadd ------------------------------ Thu Dec 31 00:00:00 1970 PST (1 row)
4. datediff
Compare the difference between the two dates
grammar :
datediff(d1 date, d2 date) return integer. datediff(t text, d1 date, d2 date) return int8. datediff(t text, d1 time, d2 time) return int8. datediff(t text, d1 timetz, d2 timetz) return int8. datediff(t text, d1 timestamp, d2 timestamp) return int8. datediff(t text, d1 timestamptz, d2 timestamptz) return int8.
describe :
Compare the specified... Between two dates text( If this parameter exists ) The format gap .
Parameters :
t
The format of the specified date gap to be returned .
d1,d2
Two date values for comparison .
Return value :
return text Integer value in the format specified by type .
annotation :
t The value of can make 'second','minute','hour','day','week','month','year' etc. .
give an example :
SELECT datediff('year','0001-01-01'::date,'9999-12-31'::date); datediff ---------- 9998 (1 row) SELECT datediff('year','1900-01-01 00:00:00'::date,'2000-12-31 00:00:00'::date); datediff ---------- 100 (1 row) SELECT datediff(month,'0001-01-01 00:00:00'::date,'9999-12-31 00:00:00'::date); datediff ---------- 119987 (1 row) SELECT datediff(month,'1900-01-01 00:00:00'::date,'2000-12-31 00:00:00'::date); datediff ---------- 1211 (1 row) SELECT datediff('month','0001-01-01 00:00:00'::date,'9999-12-31 00:00:00'::date); datediff ---------- 119987 (1 row) SELECT datediff('month','1900-01-01 00:00:00'::date,'2000-12-31 00:00:00'::date); datediff ---------- 1211 (1 row)
5. date_format
Get the specified format value of the specified date .
grammar :
date_format(d timestamp, t text) return text. date_format(d timestamptz, t text) return text.
describe :
Return date type value text Specified format .
Parameters :
t
Specifies the format of the date to return .
d
Value of target format .
Return value :
return text designated text Type value .
annotation :
t The value of can be nls_date_format All values of type .
give an example :
select date_format('2000-10-10 12:00:00','mm-yyyy-dd hh24:mi:ss'); date_format --------------------- 10-2000-10 12:00:00 (1 row)
边栏推荐
- 一名外包仔的2022年中总结
- 重绘和回流
- xrandr修改分辨率与刷新率
- [set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair
- 类的基础语法
- 金仓数据库KingbaseES 插件kdb_date_function
- X-ray normal based contour rendering
- 300+篇文献!一文详解基于Transformer的多模态学习最新进展
- 解决bp中文乱码
- Xrandr modifier la résolution et le taux de rafraîchissement
猜你喜欢
解决bp中文乱码
[free completion] development of course guidance platform (source code +lunwen)
[NLP]—sparse neural network最新工作简述
Daily question - ugly number
When writing a web project, SmartUpload is used for file upload and new string () is used for transcoding, but in the database, there will still be random codes similar to poker
Busycal latest Chinese version
[brush questions] find the number pair distance with the smallest K
Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
GFS分布式文件系统(光是遇见已经很美好了)
随机推荐
使用BENCHMARKSQL工具对KingbaseES预热数据时执行:select sys_prewarm(‘NDX_OORDER_2 ‘)报错
用户体验五要素
Know that Chuangyu cloud monitoring - scanv Max update: Ecology OA unauthorized server request forgery and other two vulnerabilities can be detected
CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
How to connect WiFi with raspberry pie
Bugku CTF daily question baby_ flag. txt
How do you use lodash linking function- How do you chain functions using lodash?
2022-07-02: what is the output of the following go language code? A: Compilation error; B:Panic; C:NaN。 package main import “fmt“ func main() { var a =
Which code editor is easy to use? Code editing software recommendation
Design and implementation of kubelet garbage collection mechanism to protect nodes from being preempted by containers image GC high threshold
Kubernetes源码分析(一)
使用BENCHMARKSQL工具对kingbasees并发测试时kill掉主进程成功后存在子线程未及时关闭
GFS分布式文件系统(光是遇见已经很美好了)
类的基础语法
有监督预训练!文本生成又一探索!
怎么用Kotlin去提高生产力:Kotlin Tips
Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
[no title] 2022 chlorination process examination content and free chlorination process examination questions
2022-02-14 (394. String decoding)
[set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair