timedelta object takes the following parameters: days, seconds, microseconds, milliseconds, minutes, hours, weeks. To find past or future dates, simply use plus or minus sign with the required difference from current date.
日历模块Calendar
Calendar related operations and displaying in formatted way.
in the formatted calendar will be Sunday. In the above example, ```Calendar.MONDAY``` is used. Hence, we can see in the output that the first day in the representation is Monday. #### Iterating through dates of a month ```Python import calendar
c = calendar.TextCalendar(calendar.MONDAY) for i in c.itermonthdays(2017, 8): print(i, end = ' ') print('') for name in calendar.month_name: print(name, end = ' ') print('') for day in calendar.day_name: print(day, end = ' ') ''' Output: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0 0 0 January February March April May June July August September October November December Monday Tuesday Wednesday Thursday Friday Saturday Sunday '''
近期评论