An utility to format current datetime as a UTC string according to RFC 3339
A procedure to use in Seeburger BIC Mapping Designer
It will extend your library for string handling
// -----------------------------
// Peter Lykkegaard, 12 okt 2022
// -----------------------------
// procedure getCurrentDateTimeUTC
// Parameters: None
// Get current date / time
// Format as String in UTC RFC 3339 format (eg 2022-10-13T23:37:18+02:00)
// Output
// alphanumeric / String
// Ref: https://medium.easyread.co/understanding-about-rfc-3339-for-datetime-formatting-in-software-engineering-940aa5d5f68a
#importJavaStart
import java.time.format.DateTimeFormatter;
import java.time.OffsetDateTime;
#importJavaEnd
local output$;
#javaStart
String output;
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX");
OffsetDateTime now = OffsetDateTime.now();
output = dtf.format(now);
_StrVar_OUTPUT.setString(output);
#javaEnd
exitProc(output$);