Just make sure that whichever way you choose, you always use the same style,
so things don't get messy.

Personally, I always use INT(11) MySQL columns and store the unix timestamp
and this makes things easy for me. The only exception is when storing dates
that are before 1970, but I very rarely have to do this.

In the end, I guess it depends if you want to do the formatting of the date
field when you're inserting the data (use TIMESTAMP) or when you're pulling
it out (use INT).


Alastair Battrick
Lightwood Consultancy Ltd
http://www.lightwood.net

> -----Original Message-----
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: 04 March 2002 22:12
> To: PHP (E-mail)
> Subject: [PHP] mktime() into TIMESTAMP ?
>
>
> PHP's mktime() function uses a timestamp that is the number of seconds
> since the Unix epoch.  MySQL uses the YYYYMMDDhhmmss format for its
> TIMESTAMP column type.
>
> I'm not complaining that they're not the same, but curious as to which I
> should use for storing timestamps -- does it matter?  PHP has a lot of
> nice formatting conventions with date(), so I am leaning towards using
> mktime() to store PHP-style timestamps into a MySQL TIMESTAMP column.
> But MySQL does have the ability to format dates, and its TIMESTAMP
> column type bumps up if I don't manually insert a value.
>
> Any suggestions?
>
>
> Erik
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to