[Python-ideas] Pythonic Dates, Times, and Deltas (original) (raw)
Marco Mariani birbag at gmail.com
Thu Oct 14 10:02:24 CEST 2010
- Previous message: [Python-ideas] Pythonic Dates, Times, and Deltas
- Next message: [Python-ideas] Pythonic Dates, Times, and Deltas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 13 October 2010 23:17, Alexander Belopolsky < alexander.belopolsky at gmail.com> wrote:
- Make it easy to get a tuple of the start and end of the month
Why would you want this? Start of the month is easy: just date(year, month, 1). End of the month is often unnecessary because it is more pythonic to work with semi-open ranges and use first of the next month instead.
And I don't care about pythonic ranges if I have to push the values through a BETWEEN query in SQL.
import calendar import datetime
end = datetime.date(year, month, calendar.monthrange(year, month)[1]) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101014/180f5efb/attachment.html>
- Previous message: [Python-ideas] Pythonic Dates, Times, and Deltas
- Next message: [Python-ideas] Pythonic Dates, Times, and Deltas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]