Re: How do I generate current UTC timestamp in raw spark sql?

2018-08-28 Thread Nikita Goyal
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

How do I generate current UTC timestamp in raw spark sql?

2018-08-28 Thread kant kodali
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