Storing time in MySQL

Hi again all,

Just here to pick some more brains.

I have some code that gets a date from a MySQL database and does some weird
and wonderful calucaltions with it.

I wish to store the end result back into the MySQL database. When I try it,
using a number of different methods, it doesn't work.

Any ideas as to the best way to store a date in a MySQL database using php?

Thanks again in advance.

Regards,

Schmalz
Gerard P Shea [ Mi, 28 März 2007 17:06 ] [ ID #1671510 ]

Re: Storing time in MySQL

Just store it in unsigned int column as a php time() (unixtime) value....
You can get it from db using from_unixtime() function, or as is... You can
store it as is, or using unix_timestamp() function... Everything you
want.....

"Schmalz" <gpshea [at] tsn.cc> wrote in message
news:460a8491$0$4611$61c65585 [at] un-2park-reader-01.sydney.pipe networks.com.au...
> Hi again all,
>
> Just here to pick some more brains.
>
> I have some code that gets a date from a MySQL database and does some
weird
> and wonderful calucaltions with it.
>
> I wish to store the end result back into the MySQL database. When I try
it,
> using a number of different methods, it doesn't work.
>
> Any ideas as to the best way to store a date in a MySQL database using
php?
>
> Thanks again in advance.
>
> Regards,
>
> Schmalz
>
>
iland_slc [ Mi, 28 März 2007 21:40 ] [ ID #1671511 ]

Re: Storing time in MySQL

Post removed (X-No-Archive: yes)
Notifier Deamon [ Fr, 30 März 2007 20:07 ] [ ID #1674163 ]

Re: Storing time in MySQL

On Mar 28, 8:06 am, "Schmalz" <gps... [at] tsn.cc> wrote:
> Hi again all,
>
> Just here to pick some more brains.
>
> I have some code that gets a date from a MySQL database and does some weird
> and wonderful calucaltions with it.
>
> I wish to store the end result back into the MySQL database. When I try it,
> using a number of different methods, it doesn't work.
>
> Any ideas as to the best way to store a date in a MySQL database using php?
>
> Thanks again in advance.
>
> Regards,
>
> Schmalz

I convert my time fields to minutes from midnight (midnight being 0,
1159pm being 1439) Its not human readable but it is computer
calculable.

When I need to have user reporting or input I have a set of functions
set up to do the conversions/validation as needed.
Larry Anderson [ Mo, 02 April 2007 02:47 ] [ ID #1676439 ]
PHP » alt.php.sql » Storing time in MySQL

Vorheriges Thema: Is This Possible?
Nächstes Thema: Problem with $PHP_SELF?