Needs programming tip using date
Raaijmakers, Vincent (IndSys, GE Interlogix)
Vincent.Raaijmakers at ge.com
Tue Aug 5 13:17:13 EDT 2003
Wow, thanks!!
Fast service.
Thank you for not letting me invent the wheel again.
Vincent
-----Original Message-----
From: Gerhard Häring [mailto:gh at ghaering.de]
Sent: Tuesday, August 05, 2003 12:27 PM
To: python-list at python.org
Subject: Re: Needs programming tip using date
Raaijmakers, Vincent (IndSys, GE Interlogix) wrote:
> I think this is a bit of a newbie question in the dates area.
Ok, the first thing you should do is download and install the eGenix
BASE package [1]. If you have a half-way decent operating system, you
can also install it via the package manager or ports system ;-)
> So before I end up in very ugly coding,
> What is THE/recommended way in checking if a date formatted as "08/05/2003", so "month/day/year"
> is the date of today or a date of the current week?
from mx.DateTime import DateTimeFrom, now
dt = DateTimeFrom("08/05/2003")
if dt.iso_week[1] == now().iso_week[1]:
print "date is in current week"
You'll want to check if the definition of iso_week matches your
definition of 'week'. [2]
-- Gerhard
[1] http://www.egenix.com/files/python/eGenix-mx-Extensions.html
[2] http://www.egenix.com/files/python/mxDateTime.html
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list