User Tools

Site Tools


manipulating_dates_in_python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
manipulating_dates_in_python [2023/09/18 17:55] – [get today's day, month and year] rajumanipulating_dates_in_python [2023/12/13 23:45] – [print the names of months in a year] raju
Line 84: Line 84:
 2023-09-18T13:55:17.214513 2023-09-18T13:55:17.214513
 </code> </code>
 +
 +Ref:- https://stackoverflow.com/questions/32490629/getting-todays-date-in-yyyy-mm-dd-in-python
  
 ==== iterate over a range of dates ==== ==== iterate over a range of dates ====
Line 158: Line 160:
   * http://pandas.pydata.org/pandas-docs/stable/generated/pandas.date_range.html   * http://pandas.pydata.org/pandas-docs/stable/generated/pandas.date_range.html
  
 +==== print the names of months in a year ====
 +<code>
 +$ ipython
 +Python 3.11.4 | packaged by Anaconda, Inc. | (main, Jul  5 2023, 13:47:18) [MSC v.1916 64 bit (AMD64)]
 +IPython 8.12.0 -- An enhanced Interactive Python. Type '?' for help.
 +
 +In [1]:
 +import calendar
 +for m in calendar.month_name:
 +    print(m)
 +
 +
 +January
 +February
 +March
 +April
 +May
 +June
 +July
 +August
 +September
 +October
 +November
 +December
 +</code>
  
manipulating_dates_in_python.txt · Last modified: 2024/02/06 05:22 by raju