List Icon
Mailing list Archive

2019 up to July 2022 | 20182017  |  2016  2015 2014 | 2013

The mailing list has been closed since July 2022, but continues to serve as an archive of information about QF-Test.
But if you want to stay informed about news about QF-Test, you can simply
Subscribe to Newsletter  

To get up-to-date information about each release - including minor releases - you can
subscribe to the RSS feed or follow us on social media.
Alternatively, QF-Test also provides release information itself.

Another source of information is our blog, where there are current articles on general topics, on the company QFS and also various "how-tos"
subscribe to blog


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

Re: [QF-Test] need Sunday of the current week (please help)


  • Subject: Re: [QF-Test] need Sunday of the current week (please help)
  • From: Michael Pruemm <eso@?.org>
  • Date: Tue, 02 Dec 2014 09:46:51 +0100

On 12/02/2014 12:52 AM, Yi Li wrote:
I’m trying to come up with a script that needs end date for the current
week (i.e Sunday).

Can someone help me please?

Here is a copy from my Jython terminal:

>>> from datetime import date, timedelta
>>> today = date.today()
>>> days_until_sunday = 6 - today.weekday()
>>> sunday = today + timedelta(days_until_sunday)
>>>
>>> today
datetime.date(2014, 12, 2)
>>> today.weekday()
1
>>> days_until_sunday
5
>>> sunday
datetime.date(2014, 12, 7)

The weekday is 0 for Monday and 6 for Sunday. If you run this on a
Sunday, both "today" and "sunday" will be the same day.

Hope that helps,

- Michael