I defined the following local time function get datetime:
def get_sysdate():
jkt_tz = pytz.timezone('Asia/Jakarta')
sysdate = datetime.now(jkt_tz).strftime('%Y-%m-%d %H:%M:%S')
return sysdate
spark.udf.register("get_sysdate", get_sysdate)
But sometimes I get the error "_all_timezones_unchecked' is not defined," and the next run works fine.