Python Day of the Week
Suppose that you want to find out the day of the week for some date, especially one some years before or after now, e.g., the day that John Lennon was murdered. If your computer runs Mac OS X or GNU/Linux, you can do it using Python, starting in the terminal application as in the following, where what you type is shown in bold.
$ python Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.date(1980,12,8).strftime('%A') 'Monday' >>> exit() $
See the documentation for date and strftime.
Note that, of course, you can do this in Windows too, if you’ve installed Python.
posted @ 10:12 AM EST