I’m writing a bit of AE scripting to check whether a desired job start time is between the current time and midnight, so that I know if a day must be added to the start date before executing the job. Here is the code:
:SET &START_TIME# = "03:10"
:SET &START_DATE# = "&$PHYS_DATE_YYYYMMDD#"
:PRINT "Today's date : &START_DATE#"
:SET &TIME_UNTIL_MIDNIGHT# = SUB_TIME("HH:MM;00:00","HH:MM;&$PHYS_TIME_HH_MM#","HH")
:SET &TIME_UNTIL_START# = SUB_TIME("HH:MM;&START_TIME#","HH:MM;&$PHYS_TIME_HH_MM#","HH")
:PRINT "Time until midnight : &TIME_UNTIL_MIDNIGHT#"
:PRINT "Time until job start : &TIME_UNTIL_START#"
:IF &TIME_UNTIL_MIDNIGHT# < &TIME_UNTIL_START#
: PRINT "Start time in current calendar day has already passed. Job will start tomorrow."
: SET &START_DATE# = ADD_DAYS("YYYYMMDD;&START_DATE#","1")
:ENDIF
:SET &START_DATE# = CONV_DATE("YYYYMMDD;&START_DATE#","YYYY_MM_DD_d")
:PRINT "Job start date : &START_DATE#"
When I run this script, the AE returns a runtime error:
8/15/2016 17:15:55 - U00020341 Runtime error in object 'UC0.MAL.COMPARE_TIMES.SCRI', line '00017'. The format of date/period 'YYYY_MM_DD_D' is invalid.
It seems the
CONV_DATE
doesn’t like the date format
YYYY_MM_DD_d. This date format is documented in the list of
Date and Time Formats, and this specific format is required by
http://docs.automic.com/documentation/AE/11.2/english/AE_WEBHELP/help.htm#ucaafh.htmACTIVATE_UC_OBJECT
(specifically, in the
Start time parameter).
Am I doing something wrong, or might this be a bug?