title: How to convert custom datetime format to timestamp?
body: <p>Any Idea why I am getting the result below?</p>
  
  <pre><code>scala&gt; val b = to_timestamp($"DATETIME", "ddMMMYYYY:HH:mm:ss")
  b: org.apache.spark.sql.Column = to_timestamp(`DATETIME`, 'ddMMMYYYY:HH:mm:ss')
  
  scala&gt; sourceRawData.withColumn("ts", b).show(6,false)
  +------------------+-------------------+-----------+--------+----------------+---------+-------------------+
  |DATETIME          |LOAD_DATETIME      |SOURCE_BANK|EMP_NAME|HEADER_ROW_COUNT|EMP_HOURS|ts                 |
  +------------------+-------------------+-----------+--------+----------------+---------+-------------------+
  |01JAN2017:01:02:03|01JAN2017:01:02:03 | RBS       | Naveen |100             |15.23    |2017-01-01 01:02:03|
  |15MAR2017:01:02:03|15MAR2017:01:02:03 | RBS       | Naveen |100             |115.78   |2017-01-01 01:02:03|
  |02APR2015:23:24:25|02APR2015:23:24:25 | RBS       |Arun    |200             |2.09     |2014-12-28 23:24:25|
  |28MAY2010:12:13:14| 28MAY2010:12:13:14|RBS        |Arun    |100             |30.98    |2009-12-27 12:13:14|
  |04JUN2018:10:11:12|04JUN2018:10:11:12 |XZX        | Arun   |400             |12.0     |2017-12-31 10:11:12|
  +------------------+-------------------+-----------+--------+----------------+---------+-------------------+
  </code></pre>
  
  <p>I am trying to convert DATETIME (which is in ddMMMYY:HH:mm:ss format) to Timestamp (which is shown in the last column above) but it doesn't seem to be converting to correct value.
  I referred the below post but no help:</p>
  
  <p><a href="https://stackoverflow.com/questions/29844144/better-way-to-convert-a-string-field-into-timestamp-in-spark/47854165#47854165">Better way to convert a string field into timestamp in Spark</a></p>
  
  <p>Anyone can help me ?</p>