Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quick Python question



On 10/08/2009 11:28 AM, Christopher Schmidt wrote:
> On Thu, Oct 08, 2009 at 11:03:38AM -0400, Jerry Feldman wrote:
>  =20
>> Recently, I've had to start writing some Python code. My question is
>> specific to the datetime object.
>> Basically, given a date, I need to add years to that date. One way to =
do
>> it is:
>>
>> from datetime import date
>> d =3D date.today() # initialize d to some date
>> d =3D date(d.year + 1, d.month, d.day)
>>    =20
> atetime.datetime.now()+datetime.timedelta(365)
>  =20
That does not work for leap year.

--=20
Jerry Feldman <gaf-mNDKBlG2WHs at public.gmane.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846








BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org