Date fields and datetimevalue - I have no clue

Hi all,

the way notes handles date/time values … is quite confusing for me, at the moment.

my form has an date entry field (show date only), with a default value of @today. Values in this field are saved without time part and no timezone information:

====================================

Data Type: Time/Date List or Range

16.08.2010

====================================

a second, computedwhencomposed field, same initial value, behaves the similar.

====================================

Data Type: Time/Date

16.08.2010

====================================

BUT NOW: in my querysave event, I have the simple LS code:

doc.dDate2 = doc.dDate1

(or doc.dDate2 = doc.dDate1(0), does the same)

now the date is stored in this format:

====================================

Data Type: Time/Date

16.08.2010 00:00:00 CEDT

====================================

And this cause quite a lot of trouble - e.g.:

  • comparing dates will use the GMTTime, which is 15.08.2010 22:00:00).

  • Setting the value of dDate2 to sth. like notesdatetime.dateonly do not work, the field keeps its old value.

What i really need/want is to save the date value in my field dDate2 in the same format as in dDate1.

thanks for any help in advance

Uwe

Subject: SetAnyTime

You’ll need to use a NotesDateTime object and setanytime. Something like

dim dt as notesdatetime

set dt = new notesdatetime(doc.ddate1(0))

call dt.setanytime

call doc.replaceitemvalue(“dDate2”, dt)

Subject: Or just use notesItem.DateTimeValue