Get yesterday's date

Gerhard Häring gerhard.haering at opus-gmbh.net
Wed Nov 27 06:59:58 EST 2002


Michel COMBE <michel.l.combe at free.fr> wrote:
> Hi,
> 
> I need to run a SQL query on a MySQL database to get yesterday's records.
> How do I specify "yesterday" ?

It's best to just use SQL. Take a look at
http://www.mysql.com/documentation/mysql/bychapter/manual_Tutorial.html#Date_calculations

> Isn't there some kind of date arithmetic in Python or should I use an
> external library ?
> Which library ?

If you want to do it in Python, mxDateTime from the eGenix mx Extensions. But
I'd really recommend to do tasks like this in SQL.
-- 
Gerhard Häring
OPUS GmbH München
Tel.: +49 89 - 889 49 7 - 32
http://www.opus-gmbh.net/



More information about the Python-list mailing list