当前位置:网站首页>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)边栏推荐
- [set theory] set concept and relationship (set family | set family examples | multiple sets)
- 商城系统搭建完成后需要设置哪些功能
- [dynamic programming] subsequence problem
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- Basic MySQL operations
- Wine travel Jianghu War: Ctrip is strong, meituan is strong, and Tiktok is fighting
- JS native common knowledge
- Square root of X
- CVPR 2022 | Dalian Technology propose un cadre d'éclairage auto - étalonné pour l'amélioration de l'image de faible luminosité de la scène réelle
- [untitled] 2022 safety production supervisor examination question bank and simulated safety production supervisor examination questions
猜你喜欢

Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended
![[fxcg] market analysis today](/img/ac/294368e3496a5b808b38833053ee81.jpg)
[fxcg] market analysis today

金仓KFS数据双向同步场景部署

The 10th China Cloud Computing Conference · China Station: looking forward to the trend of science and technology in the next decade

Dismantle a 100000 yuan BYD "Yuan". Come and see what components are in it.
![[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN](/img/7e/50fa6f65b5a4f0bb60909f57daff56.png)
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN

vulnhub HA: Natraj

国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来

Bugku CTF daily question baby_ flag. txt

Interaction free shell programming
随机推荐
Practical operation of vim
Bugku CTF daily question baby_ flag. txt
Know that Chuangyu cloud monitoring - scanv Max update: Ecology OA unauthorized server request forgery and other two vulnerabilities can be detected
Square root of X
Design and implementation of kubelet garbage collection mechanism to protect nodes from being preempted by containers image GC high threshold
GFS分布式文件系统(光是遇见已经很美好了)
Mila, University of Ottawa | molecular geometry pre training with Se (3) invariant denoising distance matching
使用BENCHMARKSQL工具对kingbasees并发测试时kill掉主进程成功后存在子线程未及时关闭
RSRS指标择时及大小盘轮动
Two points -leetcode-540 A single element in an ordered array
What are the Bluetooth headsets with good sound quality in 2022? Inventory of four high-quality Bluetooth headsets
[no title] 2022 chlorination process examination content and free chlorination process examination questions
有监督预训练!文本生成又一探索!
[NLP]—sparse neural network最新工作简述
用户体验五要素
Supervised pre training! Another exploration of text generation!
Basic MySQL operations
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 =
Mongodb slow query optimization analysis strategy
[software testing-6] & Test Management