Java 科特林问题与白天一小时时差

Java 科特林问题与白天一小时时差,java,android,kotlin,Java,Android,Kotlin,转换UTC时间并以太平洋格式显示日期和时间,在正常情况下可以正常工作,但在使用日光计时时,显示时间会减少一小时 fun utcToGivenTimeZone(dateInUtc : String, timeZone : String) : String{ var finalDateToReturn = "" try{ val dateInUtc = dateInUtc val dateTimeAfterSplit = dat

转换UTC时间并以太平洋格式显示日期和时间,在正常情况下可以正常工作,但在使用日光计时时,显示时间会减少一小时

fun utcToGivenTimeZone(dateInUtc : String, timeZone : String) : String{
    var finalDateToReturn = ""
        try{
            val dateInUtc = dateInUtc
            val dateTimeAfterSplit = dateInUtc.split("T")?.get(0) + " " + (dateInUtc.split(
                  "T")?.get(1)?.split(".")?.get(0))

            val sourceFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
            sourceFormat.timeZone = TimeZone.getTimeZone("UTC")
            val parsed = sourceFormat.parse(dateTimeAfterSplit)

            val tZone = TimeZone.getTimeZone(timeZone)
            val destFormat = SimpleDateFormat("EEE dd MMM yyyy @ hh:mm aa")
            destFormat.setTimeZone(tZone)
            val finalDate = destFormat.format(parsed)

            finalDateToReturn= finalDate.toString()

        } catch (e : Exception){
            Log.e("timezone",e.toString())
        }
    return finalDateToReturn
}

您能提供一个示例输入以及实际和预期输出吗?示例输入-周二04 Feb 2020 10:00:00 PDT现在实际输出-周二04 Feb 2020@9:00 AM expected Out-周二04 Feb 2020@10:00 AMOK,谢谢,但我不明白如果输入被认为是在
UTC
,为什么输入后面跟着
PDT
。。。什么是
PDT
?如果
2020年2月4日星期二10:00:00 PDT
是您的输入,
2020年2月4日星期二上午10:00
是您想要的输出,您认为
UTC
在哪里发挥作用?输入的时间(和日期)不一样吗?