New to LotusScript - trying to work with dates

Hi. I’m trying to get the current date, add 2 days to it, and then assign the new date to a field in a document I have open. Here’s the relevant code:

Dim ws As New NotesUIWorkspace

Dim uruidoc As NotesUIDocument

Dim iruidoc As NotesUIDocument

Dim irdoc As NotesDocument

Dim urdoc As NotesDocument

Dim requestnum As String

Dim dte As NotesDateTime

Set iruidoc = ws.currentdocument

Set uruidoc = ws.ComposeDocument(“server” , “db” , “UserReq”)

Set urdoc = uruidoc.Document

Set dte = New NotesDateTime(“Today”)

dte.AdjustDay(2)

Call uruidoc.FieldSetText(“ReqCompDte”,dte)

But when I run it, I get “Incorrect argument type: String Expected”. I have tried converting to a string, but then I get a type mismatch error. Can someone offer assistance?

Thanks!

Subject: New to LotusScript - trying to work with dates

Since you have already created the back-end document object with your “Set urdoc = uruidoc.Document”, you can now work much better with the direct command urdoc.ReqCompDte=dte.

Don’t forget to save.

Subject: New to LotusScript - trying to work with dates

The current date is Today (a built-in function in LotusScript).To add two days to it, write Today + 2 (LotusScript always computes dates in days).

To store the date in the document, write urdoc.ReqCompDte = Today + 2

If you are new to LotusScript, I suggest that you avoid NotesDateTime objects – they often cause confusion.

Subject: Try: Call uruidoc.FieldSetText(“ReqCompDte”,dte.LocalTime)