in reply to unix time and dates with mysql

Why not just keep using epoch seconds (which is what I assume you mean when you say time() format)?. You can convert back and forth between between the epoch secs and Year/Month/Day/Time with localtime and Time::Local. MySQL will treat them as integers. Else you need to convert them to dates and use the MySQL date type and MySQL will do the comparisons as date.

grep
grep> grep clue /home/users/*

Replies are listed 'Best First'.
Re: Re: unix time and dates with mysql
by lachoy (Parson) on Feb 27, 2002 at 01:19 UTC

    This sounds like a good idea, but it's not. Someday you might want to access the database from a different client, like Excel or Access, that doesn't deal with epoch seconds natively. Then you will feel much pain.

    It's far better to keep it in the native datetime format and use the DATE_FORMAT() functionality to return the date like you want -- even in epoch seconds :-)

    Chris
    M-x auto-bs-mode