ClickHosue 常用函数

目录

1.日期类函数

1.1 日期或时间日期生成函数

1.3 时间或日期截取函数(toStartOf)—— 返回日期

2.类型转化类函数

2.1 精度保留(非四舍五入)

2.2 字符串转化为整数(非整数的字符串返回0)

2.3 日期与时间日期转化

2.4 转化为字符型

2.5 查看数据类型

3.字符串操作

3.1 基本字符串操作

3.2 字符串查找

3.3 字符串替换

3.4 字符串分割

3.5 字符串拼接

4.算数函数

5.比较函数

6.逻辑函数

7. 条件语句

8. 数学函数

9. 舍入函数

10. 表操作

10.1 表连接操作

10.2 LIMIT操作

11.字典操作


1.日期类函数

1.1 日期或时间日期生成函数

函数

用途

举例

返回结果

返回类型

now() 

生成当前时间日期

now()

2020-08-14 23:46:34

DateTime

today() 

生成今天的日期

today() 

2020-08-14

Date

yesterday() 

生成昨天的日期

yesterday()

2020-08-13

Date

1.2  时间或日期截取函数(to)-返回非日期

函数

用途

举例

返回结果

返回类型

toYear()

取日期或时间日期的年份

toYear(toDateTime('2020-08-14 11:12:13’));

toYear(toDate('2020-08-14’));

toYear(now());

2020;

2020;

2020;

UInt16;

UInt16;

UInt16

toMonth() 

取日期或时间日期的月份

toMonth(toDateTime('2020-08-13 11:12:13’));

toMonth(toDate('2020-08-13')) 

8;

8;

UInt8;

UInt8

toDayOfMonth()  

取日期或时间日期的天(1-31)

toDayOfMonth(now())

14

UInt8

toDayOfWeek() 

取日期或时间日期的星期

toDayOfWeek(now());

6

UInt8

toHour() 

取时间日期的小时 

toHour(toDateTime('2020-08-13 11:12:13'))

11

UInt8

toMinute()  

取时间日期的分钟

toMinute(toDateTime(‘2020-08-13 11:12:13’)) 

12

UInt8

toSecond()  

取时间日期的秒

toSecond(toDateTime(‘2020-08-13 11:12:13’)) 

13

UInt8

toMonday() 

取时间日期最近的周一(返回日期)

toMonday(toDate('2020-08-13'));

2020-08-10

Date

toTime() 

将时间日期的日期固定到某一天,保留原始时间  

toTime(toDateTime(‘2020-08-13 11:12:13’))   

1970-01-02 11:12:13

DateTime('Asia/Chungking')

1.3 时间或日期截取函数(toStartOf)—— 返回日期

函数

   用途      

举例

返回结果

返回类型

toStartOfMonth()

取日期或时间日期的月份的第一天,返回日期。

toStartOfMonth(toDateTime('2020-08-18 11:12:13'))

2020-08-01

Date

toStartOfQuarter()

 取日期或时间日期的季度的第一天,返回日期

toStartOfQuarter(toDateTime('2018-12-11 11:12:13'))

2018-10-01

Date

toStartOfYear()

 取日期或时间日期的年份的第一天,返回日期

toStartOfYear(toDateTime('2020-08-18 11:12:13'));

toStartOfYear(toDate('2020-08-18'))

2020-01-01;

2020-01-01

Date;

Date

toStartOfMinute()

截取时间日期到分钟(之后归零),返回日期

toStartOfMinute(toDateTime('2020-08-18 11:12:13'))

2020-08-18 11:12:00

DateTime('Asia/Chungking')

toStartOfFiveMinute()

截取时间日期到最近的5的倍数分钟(之后归零),返回日期 

toStartOfFiveMinute(toDateTime('2020-08-18 11:12:13'))

2020-08-18 11:10:00

DateTime('Asia/Chungking')

toStartOfFifteenMinutes

 截取时间日期到最近的15的倍数分钟(之后归零),返回日期 

toStartOfFifteenMinutes(toDateTime('2020-08-18 11:12:13'))

2020-08-18 11:00:00

DateTime('Asia/Chungking')

toStartOfHour()

截取时间日期到小时(之后归零),返回日期

toStartOfHour(toDateTime('2020-08-18 11:12:13')

2020-08-18 11:00:00

DateTime('Asia/Chungking')

toStartOfDay() 

截取时间日期到天(之后归零),返回日期

toStartOfDay(toDateTime('2020-08-18 11:12:13'))

2020-08-18 00:00:00

DateTime('Asia/Chungking')

timeSlot()

将时间日期中,分钟大于等于30的归于30,分钟数小于30的归为00

timeSlot(toDateTime('2020-08-18 11:33:13’))

2020-08-18 11:30:00;

DateTime('Asia/Chungking')

2.类型转化类函数

2.1 精度保留(非四舍五入)

<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员学习圈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值