Code: Select all
Label>START_OF_SCRIPT
//format=1
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")),ISO_8601_format_1
//format=2
PYExec>import datetime%CRLF%print(datetime.datetime.now().astimezone().replace(microsecond=0).isoformat()),ISO_8601_format_2
//format=3
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("%Y-W%V")),ISO_8601_format_3
//format=4
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("%Y-W%V-%u")),ISO_8601_format_4
//format=5
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("%Y-%j")),ISO_8601_format_5
//format=6
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("%Y-%m-%d")),ISO_8601_format_6
//format=7
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("T%H:%M:%SZ")),ISO_8601_format_7
//format=8
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("T%H%M%SZ")),ISO_8601_format_8
//format=9
PYExec>import datetime%CRLF%print(datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%SZ")),ISO_8601_format_9
//format=10
PYExec>import datetime%CRLF%print(datetime.datetime.now().astimezone().isoformat()),ISO_8601_format_10
//bonus formats
//epoch time
PYExec>import time%CRLF%print(int(time.time())),epoch
//epoch time as float
PYExec>import time%CRLF%print(time.time()),epoch_float
//epoch in nanoseconds
PYExec>import time%CRLF%print(time.time_ns()),epoch_ns
Wait>1
Let>OUTPUT_DATA=OUTPUT:
ConCat>OUTPUT_DATA,%CRLF%%ISO_8601_format_1%
ConCat>OUTPUT_DATA,ISO_8601_format_2
ConCat>OUTPUT_DATA,ISO_8601_format_3
ConCat>OUTPUT_DATA,ISO_8601_format_4
ConCat>OUTPUT_DATA,ISO_8601_format_5
ConCat>OUTPUT_DATA,ISO_8601_format_6
ConCat>OUTPUT_DATA,ISO_8601_format_7
ConCat>OUTPUT_DATA,ISO_8601_format_8
ConCat>OUTPUT_DATA,ISO_8601_format_9
ConCat>OUTPUT_DATA,ISO_8601_format_10
ConCat>OUTPUT_DATA,epoch
ConCat>OUTPUT_DATA,epoch_float
ConCat>OUTPUT_DATA,epoch_ns
Message>OUTPUT_DATA
Goto>START_OF_SCRIPT