Compare date to doc.date field?

i have a bit of code (and havent used lotusscript for a long time…)

where doc.IssueDates(0) = 02/02/2007 as a date/time field,

if it is equal to 02/02/2007 i want to change another value

If doc.IssueDates(0) = "02/02/2007" Then

Messagebox "02/02/2007"

newdoc.Periodical = "A Magazine"

End If

Stop

what do i need to do to get this to work ??? as at the moment it doesnt recognise the two field types as data/time ??

Subject: Compare date to doc.date field ??

The comparison you are doing is treated like String Compare. If you want to compare as a Date then you need to convert the date string “02/02/2007” to NotesDateTime Object. You can get more info in Designer Help on using Notes Date Time Object. Same you can do for your Document Field value. and then use CDAT for comparison.

e.g.

Dt1 is datetime object From NotesField

Dt2 is datetime object From Comparison Date String

then

If Cdat(Dt1.DateOnly) <> Cdat(Dt2.DateOnly) then

'Your Action

End If

Using date time object is safest way, else you can also try

If Cdat(doc.IssueDates(0)) <> Cdat(“02/02/2007”) then

'Your Action

End If