Databases Reference
In-Depth Information
Date formatting
We have a column named
date_published
in our
book
table; let us change its
type to
DATETIME
. Then, we set its MIME type to
text/plain
and the browser
transformation to
text/plain: dateformat
. The next step is to edit the row for the
"Future souvenirs" book, and enter
2003-01-01 14:56:00
in the
date_published
column. When we browse the table, we now see that the column has been formatted.
Hovering the mouse over it reveals the unformatted original contents, as shown in
the following screenshot:
This transformation accepts two options. The first is the number of hours (zero by
default) that will be added to the original value. Adding number of hours can be
useful if we store all time values based on
Coordinated Universal Time
(
UTC
), but
want to display them for a specific zone (for example, UTC+5). The second option
is the time format we want to use, specified using any PHP
strftime
parameters
(more details at
http://php.net/strftime
). So, if we put
'0','Year: %Y'
in the
Transformation
options
, we will get the following output:
Links from text
Suppose that we have put a complete URL—
http://domain.com/abc.pdf
—in the
description
column in our
book
table. The text of the link will be displayed while
browsing the table, but we would not be able to click it. We will now see the use of
the
text/plain
MIME type in such a situation.
Search WWH ::
Custom Search