当前位置:Gxlcms > JavaScript > JS的日期相关函数使用详解

JS的日期相关函数使用详解

时间:2021-07-01 10:21:17 帮助过:5人阅读

这次给大家带来JS的日期相关函数使用详解,使用JS日期相关函数的注意事项有哪些,下面就是实战案例,一起来看一下。

一、 日期相关函数

select current_date();
select current_date;
select current_time;
select current_timestamp;
select date_add (current_timestamp(), interval 1 year);
select date_add (current_timestamp(), interval 1 month);
select date_sub (current_timestamp(), interval 1 year);
select date_sub (current_timestamp(), interval 1 month);
select datediff(current_timestamp(), date_add (current_timestamp(), interval 1 month );
select timediff('12:30:30', '18:30:30');
select now();select year(now());
select month(now());

二、流程控制函数

IF (expr1,expr2,expr3);
select if (1 > 0, 'hello','see you');
IFNULL (expr1,expr2);select ifnull (null, 3 + 2);
SELECT CASE WHEN expr1 then expr2 else expr3 end;
select case when 10> 0;

三、其他函数

USER();
DATABASE();
MD5(str) ;
PASSWORD(str );

相信看了本文案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!

推荐阅读:

Laravel实现多用户认证系统

PHP防SQL注入的数据安全方法

以上就是JS的日期相关函数使用详解的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行