Re: time without seconds
| From: | Ignatius Reilly | Date: | Tue, 17 Jun 2003 10:49:01 +0000 |
| Subject: | Re: time without seconds | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28672@lists.php.net to get a copy of this message | ||
Check the TIME_FORMAT(time,format) MySQL function.
Ignatius
_________________________
----- Original Message -----
From: "Lisi" <lists@shemeshdirectory.co.il>
To: "PHP-DB" <php-db@lists.php.net>
Sent: Tuesday, June 17, 2003 1:16 PM
Subject: [PHP-DB] time without seconds
> If I have a time stored in MySQL, and I only need the hour and minutes
> without seconds:
>
> 1) Can I crop this in PHP after retrieving it?
>
> 2) Is there a way to store this without the seconds in MySQL?
>
> Same goes for storing a date without the year. I could use a regular char
> field, but I want to be able to retrieve a row that corresponds to the
> current month and day, currently I am doing this with
>
> $month = date("n");
> $day = date("d");
> $query = "SELECT ... WHERE MONTH(date) = $month AND DAYOFMONTH = $day";
>
> Is there a better way to do this without storing unnecessary data?
>
> Thanks,
>
> -Lisi
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>