title: PySpark date_trunc modifies the timezone: how to prevent it?
body: <p><strong>Context:</strong> I use <a href="https://spark.apache.org/docs/2.3.0/api/sql/index.html#date_trunc" rel="nofollow noreferrer">date_trunc</a> function imported from pyspark.sql.functions to truncate timestamp to minutes.</p>
  
  <pre><code>df_truncated = df.withColumn('dt', date_trunc('minute', df["timestamp"]))
  df_truncated.show(truncate=False)
  </code></pre>
  
  <p>The output is following</p>
  
  <pre><code>+------------------------+-------------------+
  |timestamp               |dt                 |
  +------------------------+-------------------+
  |2020-01-02T00:30:47.178Z|2020-01-02 02:30:00|
  |2020-01-02T00:30:47.160Z|2020-01-02 02:30:00|
  |2020-01-02T00:30:46.327Z|2020-01-02 02:30:00|
  |2020-01-02T00:30:45.003Z|2020-01-02 02:30:00|
  |2020-01-02T00:30:44.054Z|2020-01-02 02:30:00|
  +------------------------+-------------------+
  </code></pre>
  
  <p><strong>Problem:</strong> The problem is that it "adds" two hours to the original timstamp - converts from utc to local time. </p>
  
  <p><strong>Question:</strong> How can I avoid this? Do I need to manually truncate the timestamp or there is some parameter for the date_trunc function that is not documented? Or do I need to access spark global settings and if so then how or which settings?</p>