Date Translation in MySQL

I'm looking for a quick and simple way to query a MySQL database by date, or
more specifically, by day of the week. My dates are stored in the DB in
YYYY-MM-DD HH:MM:SS format. Question, is there a built-in for PHP or MySQL
that will take this column and return only Saturdays, for example, without
having to use PHP to find each of the last X number of Saturdays and then
for each Saturday, query the database?

In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.

Thanks in advance.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ben Miller [ Di, 05 August 2008 20:09 ] [ ID #1963191 ]

RE: Date Translation in MySQL

Select * FROM ... WHERE DAYOFWEEK(datecol)=7

-----Original Message-----
From: Ben Miller [mailto:bmiller [at] westernherbal.com]
Sent: Tuesday, August 05, 2008 8:10 PM
To: PHP. DB Mail List
Subject: [PHP-DB] Date Translation in MySQL

I'm looking for a quick and simple way to query a MySQL database by date, or
more specifically, by day of the week. My dates are stored in the DB in
YYYY-MM-DD HH:MM:SS format. Question, is there a built-in for PHP or MySQL
that will take this column and return only Saturdays, for example, without
having to use PHP to find each of the last X number of Saturdays and then
for each Saturday, query the database?

In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.

Thanks in advance.



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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.12/1592 - Release Date: 05/08/2008
06:03


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Simcha Younger [ Di, 05 August 2008 22:48 ] [ ID #1963193 ]

RE: Date Translation in MySQL

Figured there had to be an easier way. Thank you so much.

-----Original Message-----
From: Simcha Younger [mailto:simcha.younger [at] gmail.com]
Sent: Tuesday, August 05, 2008 2:48 PM
To: php-db [at] lists.php.net
Subject: RE: [PHP-DB] Date Translation in MySQL


Select * FROM ... WHERE DAYOFWEEK(datecol)=7

-----Original Message-----
From: Ben Miller [mailto:bmiller [at] westernherbal.com]
Sent: Tuesday, August 05, 2008 8:10 PM
To: PHP. DB Mail List
Subject: [PHP-DB] Date Translation in MySQL

I'm looking for a quick and simple way to query a MySQL database by date, or
more specifically, by day of the week. My dates are stored in the DB in
YYYY-MM-DD HH:MM:SS format. Question, is there a built-in for PHP or MySQL
that will take this column and return only Saturdays, for example, without
having to use PHP to find each of the last X number of Saturdays and then
for each Saturday, query the database?

In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.

Thanks in advance.



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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.12/1592 - Release Date: 05/08/2008
06:03


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




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ben Miller [ Di, 05 August 2008 22:33 ] [ ID #1963196 ]

Re: Date Translation in MySQL

------=_Part_45240_28960923.1218380389976
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tue, Aug 5, 2008 at 4:33 PM, Ben Miller <bmiller [at] westernherbal.com>wrote:

> Figured there had to be an easier way. Thank you so much.
>
> -----Original Message-----
> From: Simcha Younger [mailto:simcha.younger [at] gmail.com]
> Sent: Tuesday, August 05, 2008 2:48 PM
> To: php-db [at] lists.php.net
> Subject: RE: [PHP-DB] Date Translation in MySQL
>
>
> Select * FROM ... WHERE DAYOFWEEK(datecol)=7
>
> -----Original Message-----
> From: Ben Miller [mailto:bmiller [at] westernherbal.com]
> Sent: Tuesday, August 05, 2008 8:10 PM
> To: PHP. DB Mail List
> Subject: [PHP-DB] Date Translation in MySQL
>
> I'm looking for a quick and simple way to query a MySQL database by date,
> or
> more specifically, by day of the week. My dates are stored in the DB in
> YYYY-MM-DD HH:MM:SS format. Question, is there a built-in for PHP or MySQL
> that will take this column and return only Saturdays, for example, without
> having to use PHP to find each of the last X number of Saturdays and then
> for each Saturday, query the database?
>
> In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.
>
> Thanks in advance.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.5.12/1592 - Release Date: 05/08/2008
> 06:03
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Also look at the mysql DATE_FORMAT function

--

Bastien

Cat, the other other white meat

------=_Part_45240_28960923.1218380389976--
Bastien Koert [ So, 10 August 2008 16:59 ] [ ID #1963716 ]
PHP » gmane.comp.php.database » Date Translation in MySQL

Vorheriges Thema: Help to improve MySQL query
Nächstes Thema: George Tomescu is out of the office.