title: How to convert array of string to date in pyspark?
body: <p>This is the dataframe schema structure.</p>
  <pre><code>root
   |-- validFrom: array (nullable = true)
   |    |-- element: string (containsNull = true)
  </code></pre>
  <p>This is the pyspark query where I try to get the date datatype for <code>validFrom</code>.</p>
  <pre><code>df_02 = spark.sql(&quot;&quot;&quot;
   select to_date(validFrom, 'yyyy-MM-dd') as  validFrom
   from   v_source_df_flatten
  &quot;&quot;&quot;);
  </code></pre>
  <p>But I receive the following error.</p>
  <blockquote>
  <p>due to data type mismatch: argument 1 requires (string or date or
  timestamp) type, however, 'v_starhist_df_flatten.<code>validFrom</code>' is of
  array type.</p>
  </blockquote>
  <p>What do I have to change in the <code>to_date</code> function?</p>