LS equivalent of @adjust

In a lotusscript view action, I’m creating new documents from selected documents and advancing the “EventDate” by a year less a day. I can’t get the existing doc’s EventDate value into a NotesDateTime without type mismatches…

Any suggestions?

tx, Rob

current code…

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Dim datetime As New NotesDateTime(Today)

Dim doc2 As NotesDocument

Set db = session.CurrentDatabase

Set collection = db.UnprocessedDocuments

Set doc = collection.GetFirstDocument()

While Not(doc Is Nothing)

	'make an event for next year

	Set doc2 = db.CreateDocument

	'set fields

	doc2.Subject = doc.Subject(0)

	doc2.EventTime = doc.EventTime(0)

	Set		datetime = doc.GetItemValue( "EventDate")'XXXXXXXXXX this is where it jams

	

	Call  datetime.AdjustYear( 1 )

	Call datetime.AdjustDay(-1)

	Call doc2.replaceItemValue ("EventDate", datetime)

	doc2.Positions = doc.Positions

	'save

	Call doc2.Save( True, True )

	

	

	

	Set doc = collection.GetNextDocument(doc)

Wend

End Sub

Subject: GetItemValue returns an array of values…

And what you want is the first (and presumably only) value in that field. Assuming it is actually a date (and not a string representation of a date), you would assign it to the LSLocalTime property of the NotesDateTime

i.e.

datetime.LSLocalTime = doc.GetItemValue( “EventDate”)(0)

Subject: It works

I was close but your help made the code work correctly…

Thanks