O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Date Operators

In the previous lessons, you saw how various operators work with numeric and string values. Although you can use the comparison operators with date values in the same way as numbers and strings, you must use a special syntax to perform arithmetic on date values.

Representing Dates and Times

A date value in MySQL takes the format YYYY-MM-DD or YYYYMMDD. Times take the format HH:MM:SS or HHMMSS. Until stored to the database or passed as an argument to a date function, however, this value is simply a string representation of a given date.

Date and Time

You can have both date and time components in a single value, represented in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required