title: Pyspark: Convert Column from String Type to Timestamp Type
body: <p>I have been using pyspark 2.3. I have data frame containing 'TIME' column in String format for DateTime values. where the column looks like:</p>
  
  <pre><code>+---------------+
  |           TIME|
  +---------------+
  | 2016/04/14 190|
  | 2016/04/15 180|
  |2016/04/14 1530|
  |2016/04/16 1530|
  | 2016/04/17 160|
  +---------------+
  </code></pre>
  
  <p>where the first two digits in  <code>190</code> or <code>1530</code>  representing the hour and the rest is the minutes.
  I tried to convert it to a timestamp type using the following lines:</p>
  
  <pre><code>df.withColumn('TIME_timestamp',fn.unix_timestamp('TIME','yyyy/MM/dd HHMM').cast(TimestampType()))
  </code></pre>
  
  <p>and also :</p>
  
  <pre><code>df.withColumn('TIME_timestamp', fn.to_timestamp("TIME", 'yyyy/MM/dd HHMM'))
  </code></pre>
  
  <p>but the resulting is:</p>
  
  <pre><code>+---------------+-------------------+
  |           TIME|     TIME_timestamp|
  +---------------+-------------------+
  | 2016/04/14 190|               null|
  | 2016/04/15 180|               null|
  |2016/04/14 1530|               null|
  |2016/04/16 1530|               null|
  | 2016/04/17 160|               null|
  +---------------+-------------------+
  </code></pre>
  
  <p>So the desired Dataframe should look like:</p>
  
  <pre><code>+---------------+
  | TIME_timestamp|
  +---------------+
  | 16-04-15 19:00|
  | 16-04-15 18:00|
  | 16-04-15 15:30|
  | 16-04-15 15:30|
  | 16-04-15 16:00|
  +---------------+
  </code></pre>