Hi,
One way is to write own UDF and use UTC zone inside it.
Something like :
import org.joda.time.{DateTime,DateTimeZone}
import java.sql.Timestamp
val getCurrentTimestampUTC = udf(() => {
new Timestamp(new DateTime(new Date()).withZone(DateTimeZone.UTC).getMillis)
})
Note : I've not tested
Hi All,
How do I generate current UTC timestamp using spark sql?
When I do curent_timestamp() it is giving me local time.
to_utc_timestamp(current_time(), ) takes timezone in the second
parameter and I see no udf that can give me current timezone.
when I do