当前位置:网站首页>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)
边栏推荐
- Nat. Comm. | 使用Tensor-cell2cell对细胞通讯进行环境感知去卷积
- FFMpeg example
- Introduction to eth
- Leecode swipe questions and record LCP 18 breakfast combination
- Small program animation realizes the running lantern and animation object
- 2022 beautician (intermediate) new version test questions and beautician (intermediate) certificate examination
- 拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。
- The 10th China Cloud Computing Conference · China Station: looking forward to the trend of science and technology in the next decade
- 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 =
- How do you use lodash linking function- How do you chain functions using lodash?
猜你喜欢
[free completion] development of course guidance platform (source code +lunwen)
leetcode:297. Serialization and deserialization of binary tree
Supervised pre training! Another exploration of text generation!
Five elements of user experience
Database management tool, querious direct download
[graduation season · aggressive technology Er] Confessions of workers
GFS分布式文件系统(光是遇见已经很美好了)
Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
China Mobile Internet of things oneos and onenet were selected in the list of 2021 Internet of things demonstration projects
随机推荐
[fairseq] error: typeerror:_ broadcast_ coalesced(): incompatible function arguments
Interface in TS
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
x Problem B
Deep dive kotlin synergy (19): flow overview
国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
用户体验五要素
有监督预训练!文本生成又一探索!
使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver
Basic syntax of class
商城系统搭建完成后需要设置哪些功能
sklearn数据预处理
拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。
CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
Know that Chuangyu cloud monitoring - scanv Max update: Ecology OA unauthorized server request forgery and other two vulnerabilities can be detected
JS realizes the animation effect of text and pictures in the visual area
vulnhub HA: Natraj
[literature reading] sparse in deep learning: practicing and growth for effective information and training in NN
C language series - Section 3 - functions
Joint set search: merge intervals and ask whether two numbers are in the same set