这次给大家带来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 );
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
推荐阅读:
laravel实现多用户认证系统
php防sql注入的数据安全方法
以上就是js的日期相关函数使用详解的详细内容。