Hello everybody. I have a project about the weather. And I am facing conversion problem, I am getting sunrise and sunset to Long (seconds) and I need to convert to HH: mm. When I run the application, I get invalid data, sunrise: 23:30 and sunset: 14:42. Although, in fact, we have sunrise at 5:30, sunset at 20:42. I can see a difference of 6 hours since we live in UTC +6 timezone, could this be related? how to convert correctly? my transform function :
fun Long?.format(pattern: String? = "dd/MM/yyyy"): String{
this?.let {
    val sdf = SimpleDateFormat(pattern, Locale.getDefault())
    return sdf.format(Date(this * 1000))
}
return ""
}
mainactivity code
private fun setValuesToViews(it: ForeCast) {
    val tvTemperature = findViewById<TextView>(R.id.tv_temperature)
    val tvDate = findViewById<TextView>(R.id.tv_date)
    val tvTempMax = findViewById<TextView>(R.id.tv_temp_max)
    val tvTempMin = findViewById<TextView>(R.id.tv_temp_min)
    val tvFeelsLike = findViewById<TextView>(R.id.tv_feels_like)
    val tvWeather = findViewById<TextView>(R.id.tv_weather)
    val tvSunrise = findViewById<TextView>(R.id.tv_sunrise)
    val tvSunset = findViewById<TextView>(R.id.tv_sunset)
    val tvHumidity = findViewById<TextView>(R.id.tv_humidity)
    tvTemperature.text = it.current?.temp?.toString()
    tvDate.text = it.current?.date.format()
    tvTempMax.text = it.daily?.get(0)?.temp?.max?.roundToInt()?.toString()
    tvTempMin.text = it.daily?.get(0)?.temp?.min?.roundToInt()?.toString()
    tvFeelsLike.text = it.current?.feels_like?.roundToInt()?.toString()
    tvWeather.text = it.current?.weather?.get(0)?.description
    tvSunrise.text = it.current?.sunrise.format("hh:mm")
    tvSunset.text = it.current?.sunset.format("hh:mm")
    tvHumidity.text = "${it.current?.humidity?.toString()} %"
}
 
    