Home > Web Front-end > JS Tutorial > body text

Detailed explanation of the use of date-related functions in JS

php中世界最好的语言
Release: 2018-03-26 09:28:48
Original
1984 people have browsed it

This time I will bring you JS date-related functions Detailed explanation of usage, precautions when using JS date-related functions, the following is a practical case, let’s take a look.

1. Date related Function

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());
Copy after login

2.Process controlFunction

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;
Copy after login

3.Other functions

USER();
DATABASE();
MD5(str) ;
PASSWORD(str );
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Laravel implements multi-user authentication system

PHP data security method to prevent SQL injection


The above is the detailed content of Detailed explanation of the use of date-related functions in JS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!