Pyspark 从utc开始,时间戳不考虑夏令时

Pyspark 从utc开始,时间戳不考虑夏令时,pyspark,apache-spark-sql,Pyspark,Apache Spark Sql,我需要将UTC的时间戳转换为MST或EST时间,但它不考虑夏令时。 另外,使用MST或EST更好,还是应该使用“美国/凤凰”或“美国/纽约” 请帮忙 谢谢, Naveed使用美国/纽约用于东方和美国/凤凰用于山区时区,Spark来自utc时间戳的时间戳功能将自动为我们覆盖日光计时 示例: #set timezone for the session spark.conf.set('spark.sql.session.timeZone', 'America/New_York') #dayl

我需要将UTC的时间戳转换为MST或EST时间,但它不考虑夏令时。 另外,使用MST或EST更好,还是应该使用“美国/凤凰”或“美国/纽约”

请帮忙

谢谢,
Naveed

使用
美国/纽约
用于
东方
美国/凤凰
用于
山区
时区,Spark
来自utc时间戳的时间戳
功能将自动为我们覆盖日光计时

示例:

#set timezone for the session    
spark.conf.set('spark.sql.session.timeZone', 'America/New_York')

#daylight saving time i.e -4:00 hrs from utc
spark.sql("""select current_timestamp as current_ts,from_utc_timestamp(current_timestamp,"America/New_York") utc_to_est""").show(10,False)
#+-----------------------+-----------------------+
#|current_ts             |utc_to_est             |
#+-----------------------+-----------------------+
#|2020-05-10 19:04:28.369|2020-05-10 15:04:28.369|
#+-----------------------+-----------------------+

#after daylight saving time that will be -5:00 hrs from utc.
spark.sql("""select from_utc_timestamp("2020-12-10 15:04:28.369","America/New_York") utc_to_est""").show(10,False)
#+-----------------------+
#|utc_to_est             |
#+-----------------------+
#|2020-12-10 10:04:28.369|
#+-----------------------+

你应该提供一个最小的可重复的例子。