일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- 윈도우
- String Functions and Operators
- Date and Time Functions
- Tibero
- 전자정부 표준프레임워크
- String Functions and Date Operators
- SVN
- Sring Functions and Operators
- MySQL
- Oracle
- HTTP
- 방화벽
- Data and Time Functions
- String Function and Operators
- Date and Time Function
- 오라클
- 티베로
- 전자정부표준프레임워크
- Today
- Total
웹이야기
MySQL NOW() 본문
MySQL 날짜함수, 시간함수
NOW()
- 현재 날짜와 시간을 구하는 함수.
NOW([fsp])
의 형태
Returns the current date and the time as a value in 'YYYY-MM-DD hh:mm:ss' or YYYYMMDDhhmmss format, depending on whether the function is used in string or numeric context. The value is expressed in the session time zone.
If the fsp argument is given to specify a fractional seconds precision from i to 6, the return value includes a fractional part of that many digits.
NOW() returns a constant time that indicates the time at which the statement began to execute.(Within a stored function or trigger, NOW() returns the time at which the function or triggering statement began to execute.) This differs from the behavior for SYSDATE(), which returns the exact time at which it executes.
semysql> SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2020-04-02 14:29:46 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW()+0;
+----------------+
| NOW()+0 |
+----------------+
| 20200402142951 |
+----------------+
1 row in set (0.00 sec)
mysql> SELECT NOW(4);
+--------------------------+
| NOW(4) |
+--------------------------+
| 2020-04-02 14:30:08.2064 |
+--------------------------+
1 row in set (0.00 sec)
SELECT NOW(), Smysql> SELECT NOW(), SLEEP(2), NOW();
+---------------------+----------+---------------------+
| NOW() | SLEEP(2) | NOW() |
+---------------------+----------+---------------------+
| 2020-04-02 14:30:30 | 0 | 2020-04-02 14:30:30 |
+---------------------+----------+---------------------+
1 row in set (2.00 sec)
mysql> SELECT SYSDATE(), SLEEP(2), SYSDATE();
+---------------------+----------+---------------------+
| SYSDATE() | SLEEP(2) | SYSDATE() |
+---------------------+----------+---------------------+
| 2020-04-02 14:30:57 | 0 | 2020-04-02 14:30:59 |
+---------------------+----------+---------------------+
1 row in set (2.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL PERIOD_DIFF() (0) | 2020.04.02 |
---|---|
MySQL PERIOD_ADD() (0) | 2020.04.02 |
MySQL MONTHNAME() (0) | 2020.04.02 |
MySQL MONTH() (0) | 2020.04.02 |
MySQL MINUTE() (0) | 2020.04.02 |