title: How can I convert a string type column in a class to datetime in parse.com?
body: <p>I have a column filled with dates. I imported all of the data using the csv importer. (parse.com)</p>
  
  <p>I have tried reformatting the dates to match the formatting used in parse's other datetime fields. Here's the python I used to reformat the initial dates. It runs in a folder which contains my monthly logs as csv files. The date for changing is in the fifth column (ie - <code>row[4]</code>). </p>
  
  <pre><code>import os
  import csv
  import datetime
  import time
  from os import listdir
  mypath = os.getcwd()
  
  def find_csv_filenames( path_to_dir, suffix=".csv" ):
      filenames = listdir(path_to_dir)
      return [ filename for filename in filenames if filename.endswith( suffix ) ]
  
  for each in find_csv_filenames(mypath):
  
      with open(each,'rb') as csvfile:
          spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
          next(spamreader, None)  # skip the headers
          for row in spamreader:          
              # twilio formatting "yyyy-MM-dd hh:mm:ss PDT"  / or sometimes PST
              date_object = datetime.datetime.strptime(row[4][:-4], "%Y-%m-%d %H:%M:%S")
              # parse formatting"yyyy'-'MM'-'dd'T'HH':'mm':'ss.SSS'Z'"
              row[4] = date_object.strftime("%Y-%m-%dT%H:%M:%S.1%MZ")
              row[2] = ''
              print ', '.join(row)
  </code></pre>