[Tutor] Through a glass, darkly: the datetime module
breamoreboy at yahoo.co.uk
Sun Oct 7 01:42:17 CEST 2012
On 07/10/2012 00:19, Richard D. Moores wrote:
> On Fri, Oct 5, 2012 at 7:15 AM, Walter Prins <wprins at gmail.com> wrote:
>> Does this hint help?
>>>>> import datetime
>>>>> mydate = datetime.date(2012,10,5)
>>>>> mydate = mydate + datetime.timedelta(days=30)
>>>>> print mydate
> Yes! Thanks to all for their rapid responses.
> But now I'm thinking it would be handy to not only know that, say, 500
> days from today is 2014-02-18, but to know what day if the week that
> is. I suppose the calendar module is to be used for this, but I
> haven't been able to get it to work for me. So what day of the week IS
> The docs say
> calendar.weekday(year, month, day)
> Returns the day of the week (0 is Monday) for year (1970–...), month
> (1–12), day (1–31).
>>>> import calendar
>>>> calendar.weekday(2014, 2, 18)
> That "1" means Tuesday, right? But how can I use calendar to print out
> that word, "TUESDAY"?
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor