title: How to calculate Max(Date) and Min(Date) for DateType in pyspark dataframe?
body: <p>The dataframe has a date column in string type <code>'2017-01-01'</code> </p>
  
  <p>It is converted to <code>DateType()</code></p>
  
  <pre><code>df = df.withColumn('date', col('date_string').cast(DateType()))
  </code></pre>
  
  <p>I would like to calculate the <code>first day</code> and <code>last day</code> of the column. I tried with the following codes, but they do not work. Can anyone give any suggestions? Thanks!</p>
  
  <pre><code>df.select('date').min()
  df.select('date').max()
  
  df.select('date').last_day()
  df.select('date').first_day()
  </code></pre>