Database Reference
In-Depth Information
+-------------+--------------------+
| Birdwatcher | Days Since Spotted |
+-------------+--------------------+
| Marie Dyer | 129 |
+-------------+--------------------+
In this example, weused
CONCAT()
to put together the bird-watcher's first and last
name. We issued thefirst
UNIX_TIMESTAMP()
with no argument, so it used the current
date and time. The second
UNIX_TIMESTAMP()
specifies a column (
time_seen
)
containing the date our bird-watchers spotted each bird. The function changed the value to
a Unix timestamp so that we could do a comparison
There are other ways and other functions that may be used to compare dates and times.
We'll look at those later in this chapter. Let's look next at how to extract the date and time
components.