Gravatar for

Question by mhogue, May 1, 2017 9:08 PM

String converting to ISO-8601 date without permission

I have set @commonpublishdate as a string. When the code below executes I see a unix timestamp in the log. However, the field displays in the Content Browser as an invalid ISO-8601 formatted date. I want it to display as a string representation of the unix timestamp. Do you have any suggestions?

publishdate = SafeGetFieldValue('publishdate')
if publishdate:
    publishdate = str(publishdate[0]) 
    d = dateutil.parser.parse(publishdate)
    commonpublishdate = time.mktime(d.timetuple())
    log("commonpublishdate: "+str(int(commonpublishdate)), 'debug')
    document.add_meta_data({"commonpublishdate": str(int(commonpublishdate))})

0 Reply
Ask a question