개발 한 스푼

[MySQL] DATE, DATETIME , CURDATE()

idleday 2023. 1. 5. 17:12

MySQL TYPE


 

DATE, DATETIME, TIMESTAMP

 

https://dev.mysql.com/doc/refman/5.7/en/datetime.html

 

MySQL :: MySQL 5.7 Reference Manual :: 11.2.2 The DATE, DATETIME, and TIMESTAMP Types

11.2.2 The DATE, DATETIME, and TIMESTAMP Types The DATE, DATETIME, and TIMESTAMP types are related. This section describes their characteristics, how they are similar, and how they differ. MySQL recognizes DATE, DATETIME, and TIMESTAMP values in several f

dev.mysql.com

 

 

CURDATE()

특징

  • CURDATE() : 현재 날짜 반환
    • CURRENT_DATE(), CURRENT_DATE 와 동일
  • CURTIME() : 현재 시간 반환
  • NOW() : 현재 날짜+시간 반환

 

 

https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_now

 

 

DATE - DATETIME 타입값 비교

  • MySQL 서버가 DATE 타입값을 DATETIME 으로 변환

https://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-conversion.html
https://bugs.mysql.com/bug.php?id=28929

 

 

 

 

 

+ Comparing a date with function NOW() (for example) is not working anymore

  • 로직이 바뀌었다고한다  (2008)
  • NOW() -> CURDATE()
  • isDate() 로 해결한다고~

http://download.nust.na/pub6/mysql/doc/refman/5.1/en/using-date.html

 

MySQL :: MySQL 5.1 Reference Manual :: B.5.5.2 Problems Using DATE Columns

 

download.nust.na

https://bugs.mysql.com/bug.php?id=28929

 

MySQL Bugs: #28929: Comparing date field with NOW() broken

 

bugs.mysql.com

http://download.nust.na/pub6/mysql/doc/refman/5.1/en/using-date.html

 

 

 

 

 

 

 


ref)

https://dev.mysql.com/doc/refman/5.7/en/datetime.html

 

MySQL :: MySQL 5.7 Reference Manual :: 11.2.2 The DATE, DATETIME, and TIMESTAMP Types

11.2.2 The DATE, DATETIME, and TIMESTAMP Types The DATE, DATETIME, and TIMESTAMP types are related. This section describes their characteristics, how they are similar, and how they differ. MySQL recognizes DATE, DATETIME, and TIMESTAMP values in several f

dev.mysql.com

https://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-conversion.html

 

MySQL :: MySQL 5.7 Reference Manual :: 11.2.8 Conversion Between Date and Time Types

11.2.8 Conversion Between Date and Time Types To some extent, you can convert a value from one temporal type to another. However, there may be some alteration of the value or loss of information. In all cases, conversion between temporal types is subject

dev.mysql.com

https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_now

 

MySQL :: MySQL 8.0 Reference Manual :: 12.7 Date and Time Functions

12.7 Date and Time Functions This section describes the functions that can be used to manipulate temporal values. See Section 11.2, “Date and Time Data Types”, for a description of the range of values each date and time type has and the valid formats

dev.mysql.com

'개발 한 스푼' 카테고리의 다른 글

[GIT] 이미 push한 커밋 메세지 수정하기  (0) 2023.03.31
JSP  (0) 2023.01.10
[MySQL] WHERE 1=1  (0) 2023.01.05
[iBatis] 다중쿼리 (MySQL)  (0) 2023.01.03
Insert into same table trigger mysql  (0) 2023.01.03