当前位置:网站首页>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)边栏推荐
- 类的基础语法
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- sd卡数据损坏怎么回事,sd卡数据损坏怎么恢复
- [no title] 2022 chlorination process examination content and free chlorination process examination questions
- [brush questions] most elements (super water king problem)
- Xrandr modify resolution and refresh rate
- 使用BENCHMARKSQL工具对KingbaseES预热数据时执行:select sys_prewarm(‘NDX_OORDER_2 ‘)报错
- PostgreSQL database high availability Patroni source code learning - etcd class
- Mila、渥太华大学 | 用SE(3)不变去噪距离匹配进行分子几何预训练
- Interaction free shell programming
猜你喜欢

vulnhub HA: Natraj

跨境电商多商户系统怎么选

解决bp中文乱码
![[literature reading] sparse in deep learning: practicing and growth for effective information and training in NN](/img/7e/50fa6f65b5a4f0bb60909f57daff56.png)
[literature reading] sparse in deep learning: practicing and growth for effective information and training in NN

Design and implementation of JSP logistics center storage information management system
![[Thesis Writing] how to write the overall design of JSP tourism network](/img/02/841e8870c2ef871c182b9bb8252a83.jpg)
[Thesis Writing] how to write the overall design of JSP tourism network

Supervised pre training! Another exploration of text generation!

Introduction of pointer variables in function parameters

Basic use of continuous integration server Jenkins
![[free completion] development of course guidance platform (source code +lunwen)](/img/14/7c1c822bda050a805fa7fc25b802a4.jpg)
[free completion] development of course guidance platform (source code +lunwen)
随机推荐
sd卡数据损坏怎么回事,sd卡数据损坏怎么恢复
因果AI,下一代可信AI的产业升级新范式?
P35-P41 fourth_ context
[untitled] 2022 safety production supervisor examination question bank and simulated safety production supervisor examination questions
[Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
Solve BP Chinese garbled code
[set theory] set identities (idempotent law | exchange law | combination law | distribution rate | De Morgan law | absorption rate | zero law | identity | exclusion law | contradiction law | complemen
有监督预训练!文本生成又一探索!
Database management tool, querious direct download
[brush questions] connected with rainwater (one dimension)
Social phobia of contemporary young people (II)
Five elements of user experience
Sklearn data preprocessing
Fcpx template: sweet memory electronic photo album photo display animation beautiful memory
Competitive product analysis and writing
Small program animation realizes the running lantern and animation object
Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
Taking two column waterfall flow as an example, how should we build an array of each column
JS realizes the animation effect of text and pictures in the visual area