|
Posted by larry on 10/28/07 05:29
On Oct 27, 11:01 am, Michael Fesser <neti...@gmx.de> wrote:
> .oO(la...@portcommodore.com)
>
> >I prefer to store my dates in YYYYMMDD format on my tables for
> >compactness and readability
>
> This is not a problem as long as a proper date type is used in the table
> (DATE or DATETIME for example). In MySQL dates are stored as YYYY-MM-DD
> strings, but YYYYMMDD is also possible in a numeric context.
>
> >and worked up a bunch of functions for
> >working with them
>
> Looks pretty complicated. MySQL and PHP have a lot of date functions,
> which already can do most of that. With properly stored dates such
> calculations are as easy as adding two integers. MySQL is also able to
> return Unix timestamps, which can then easily be used with PHP's date
> functions.
>
[snip]
>
> You might want to consider to use regular expressions, which makes it
> very easy to test against different patterns.
>
> Micha
For the format, I was thinking of long term or DB agnostic, where I
may not have MySQL compatible fields, so I went with integer.
As for regular expressions haven't quite got the hang of those yet (at
least it is all in one place so I can fix it when I do.)
[Back to original message]
|