How to get the current date from the server

I want to get the current date from the server, and my database is on the server, and which function mysql now () and CURDATE () will give, whether it be a client machine or a server. Please help. this is what i did

insert into admission_fees_structure (Fee_Head_Name , Amount,Created_Date , Created_By) values (feeName, amount, now(),userID); select name into @result from sims.school_session where YEAR(Start_Date)=YEAR(CURDATE()); 
+4
source share
3 answers

Both functions are performed by MySQL. Thus, they return the date and time of the MySQL system.

+1
source

There are 8 ways to get the current time:

 SELECT NOW() FROM DUAL; 2006-07-01 10:02:41 SELECT CURRENT_TIME() FROM DUAL; 10:02:58 SELECT SYSDATE() FROM DUAL; 2006-07-01 10:03:21 mysql> SELECT CURRENT_TIMESTAMP() FROM DUAL; 2006-07-01 10:04:03 SELECT LOCALTIME() FROM DUAL; 2006-07-01 10:07:37 mysql> SELECT LOCALTIMESTAMP() FROM DUAL; 2006-07-01 10:08:08 mysql> SELECT UTC_TIME() FROM DUAL; 14:09:22 mysql> SELECT UTC_TIMESTAMP() FROM DUAL; 2006-07-01 14:09:49 
+10
source

replace now () with the CURDATE () function ... I also use this code

0
source

Source: https://habr.com/ru/post/1494885/


All Articles