pturmel
November 7, 2023, 11:59pm
9
Cole_Townsend:
my final solution
You really should not be doing imports in transforms (or any other defs where you can avoid it). Delegate to a project library utility script, like shown here:
Sure. I recommend DateTimeFormatter.ofPattern() . But I would move the complexity to a project script module with a DateTimeFormatter instance with your preferred pattern saved as a top level variable. Like so, perhaps:
from java.time import ZoneId
from java.time.format import DateTimeFormatter
defaultFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm")
def zonedFormat(ts, zoneid, format=None):
formatter = defaultFormatter if format is None else DateTimeFormatter.ofPattern(format)
r…