[fwlug] MySQL field parameter: "default "as defined:"
Matt Mayers
matt at mattmayers.com
Sat May 29 19:42:46 CDT 2010
You can call UNIX_TIMESTAMP() on the TIMESTAMP field in your SELECT
statement to get that value if you need it. It seems odd to me to sacrifice
the convenience of MySQL's time/date functions to make things easier on the
PHP side.
--
Matt Mayers
mmayers at gmail.com
http://mattmayers.com/
On Sat, May 29, 2010 at 8:30 PM, Travis Paul <travis at actionowl.org> wrote:
> Thanks Matt,
> But I'd really like to store most of my date values as int(10), as unix
> time is the easiet to format with php's date() function. Most of my date
> values are after 1969 and int(10) is the most efficient way to store the
> dates.
> If I store my dates as TIMESTAMP I'll have to call strtotime() on each
> value.
>
> On May 29, 2010 8:23 PM, "Matt Mayers" <matt at mattmayers.com> wrote:
>
> If you have a column type of TIMESTAMP, you can set DEFAULT
> CURRENT_TIMESTAMP to achieve this. However, keep in mind that all values are
> converted from the machine's local time to UTC before being stored in a
> TIMESTAMP field and automatically converted back to local time
> when retrieved. http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
>
> --
> Matt Mayers
> mmayers at gmail.com
> http://mattmayers.com/
>
> On Sat, May 29, 2010 at 6:53 PM, Travis Paul <travis at actionowl.org> wrote:
> > > I think you're righ...
>
> _______________________________________________
> Fwlug mailing list
> Fwlug at fortwaynelug.org
> http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
>
>
> _______________________________________________
> Fwlug mailing list
> Fwlug at fortwaynelug.org
> http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://fortwaynelug.org/pipermail/fwlug_fortwaynelug.org/attachments/20100529/41b9bad7/attachment-0001.html>
More information about the Fwlug
mailing list