title: What is the difference between strptime and strftime?
body: <p>I am working on a project , where  I have dictionary with column date called &quot;starttime&quot; .. I need to extract month , hour and year , day of the week.
  I am stuck for now I have the below code .</p>
  <pre><code>   {if city =='NYC':
          datn = datum[('starttime')]
          datn = dt.strptime(datn,&quot;%m/%d/%y %H:%M:%S&quot;)
          hour = dt.strftime(datn,&quot;%H&quot;)
          year = dt.strftime(datn,&quot;%y&quot;)
      elif city == 'Chicago':
      datc = datum[('starttime')]
      datc = dt.strptime(datc,&quot;%m/%d/%y %H:%M&quot;)
      month = dt.strftime(datc,&quot;%m&quot;)
      hour = dt.strftime(datc,&quot;%H&quot;)
      year = dt.strftime(datc,&quot;%y&quot;)
      else:
      datw = datum[('start date')]
      datw = dt.strftime (datw,&quot;%m&quot;)
      hour = dt.strftime(datw,&quot;%H&quot;)
      year = dt.strftime(datw,&quot;%y&quot;)
                                
  return (month, hour, day_of_week)
     } 
  </code></pre>
  <p>my import statements are on the top of my code , as below:</p>
  <pre><code>from datetime import datetime
  </code></pre>