Re: [Templates] mysql date parsing
[prev]
[thread]
[next]
[Date index for 2004/07/01]
Dennis Daupert wrote:
>>man Template::Plugin::Date
>># specify time as seconds since epoch or 'h:m:s d-m-y' string
>>
>>
>
>It looks like we've gone all around the horn on this one :-)
>
>Mysql writes his timestamps in "mysql" notation. My original
>question was whether there's a plugin or some simple macro
>code that can humanize mysql's notation. It looks like
>Template::Plugin::Date is not the way to go, since mysql
>doesn't store timestamps in unix seconds.
>
>I have a longer look at Time::Piece::MySQL, then.
>
>
>
Actually, if you read the docs, you'll discover that it DOES store the
timestamp in unix seconds. What it doesn't do it emit the raw unix
time... and the UNIX_TIMESTAMP wrapped around it quite simply dumps the
raw integer value of the timestamp.
Mysql _is_ humanizing that timestamp... into a horrible, horrible
notation. :)
Still, I can tell you that you should never patch in code what you can
solve in SQL. Select the unix timestamp and feed it to the standard
plugin and you'll not have to depend on YetAnotherModule. Plus, since
the Date plugin works fine for the Date and Datetime fieldtypes in mysql
you'll be using it elsewhere and sooner or later you'll cross the
streams and it'll blow up on you.
The way to fix the output of SQL is with SQL. Its a reporting
language... that is its job.
--mark
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
(message missing)
|