In lotusScript: I've used:
doc.DocDate = Format(document.get("DatePublished"),"mm/dd/yyyy") 'Rem return 08/22/2017
In formula: I've used for to get year:
@Year(DocDate)
But when i run the program i get the error : "incorrect data type for operator or @function time/date expected". How to fix it?
Get date value with
document.DatePublished(0)
or
document.GetItemValue("DatePublished")(0)
Then your field DocDate should be calculated properly.
@Year()
expects a NotesDateTime value. DocDate is a String value though. You can change your formula to
@Year(@ToTime(DocDate))
and it will work if your language settings are set to US date format.