Most methods for setting a date field via LotusScript leave you with a date in this format:
13/07/2014 00:00:00 GDT
The time section always seems to get set either to the current time or 00:00:00.
If the date is required to be stored in the same format as it would be if chosen from the date picker on a form, the time part must be removed.
The LotusScript functions, CDat, DateNumber, DateValue, Format are no help here, nor is the notesddatetime object -- unless you do what I have done in the following function.
The function takes a document, a fieldname and a date and sets the field equal to the date only value of the date, without the time part.
Function SetDate(doc As notesdocument, strFieldName As String, strDate As String) 'Takes a Date and puts it in a field without any time part nonsense and as a proper date not a string. Dim dtmTemp As New notesdatetime ("") dtmTemp.LSLocalTime = Datevalue(strDate) Call dtmTemp.setAnyTime doc.ReplaceItemValue strFieldName, dtmTemp End Function
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Brendan Dougan. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.