title: Making all String Dates Uniform to YYYYMMDD in PySpark
body: <p>i've got a pyspark dataframe with about 60 columns</p>
  <pre><code>|name|address|date|
  | han|123.   |19970401|
  |dan |boul.  |20100509|
  |lan |street1|2010-04-02|
  |kim |street2|02112020|
  |red |street3||
  |derek|street4|03/01/2001|
  </code></pre>
  <p>I'm trying to make as many of the columns as uniform as possible so it is in the format of yyyymmdd
  I'm fairly new to PySpark and I know there's functions like 'rlike' and 'regex_exp'
  Since i'm using python 3.7, i'm thinking a long winded if-else statement but i'm having trouble</p>
  <p>This is the method i'm thinking of going with but seems inefficient and not very clean</p>
  <pre><code>def formatDates(date):
      regex = &quot;\d{8}&quot;
  
      if date.filter(date.date.contains('')):
          #add to clean format column
      elif date.filter(date.date.rlike(regex)):
          #add to clean format column
      elif date.filter(date.date.rlike('\d{4}\-\d{2}\-\d{2}')):
          #remove '-' and add to clean format column
      else:
          date.show() #show any that don't match above and add to statement 
  </code></pre>
  <p>Any help would be appreciated, thank you!</p>