I have a issue to solve: the date (today) in the date field of my documents are saved as yesterday.
I have a form that supports several different entries, that is, date, text, numbers and so on.
This form does not become a document. Through lotusScript I wrote a code that save those data in another form, whose has the same field (as itens, of course).
So, my views show select documents based in the last above saved form.
Looking inside the properties of the document, looking for that date field, there is the correct date (today).
Trying a workaround, I intended to write another code to rewrite dates to that date field, but it confirms the wrong date (yesterday) not the correct one.
Sorry, that’s still exactly what you don’t want to do. CDat returns a date/time variant, so if you assign that to a field you still get the 12:00:00 AM. You have to do something like this:
Dim dt As NotesDateTime
dim docCur as notesdocument
set docCur = uidoc.document
set dt = doc.GetFirstItem(“AliTxtDaD”).DateTimeValue
docOther.ReplaceItemValue “DefTxtDaD”, dt
call docOther.save(true,false)
I also draw your attention to the CopyItemToDocument method.
When you store a date with LotusScript, if you don’t want to also store a time of day, you must use the NotesDateTime class with SetAnyTime method. If you just do something like:
doc.Fieldname = Today
then it’s really storing today at 12:00:00 AM, which is yesterday in some timezones. The date/time variant doesn’t distinguish between “date only” and midnight.