Set date without time via LotusScript

This tip shows you how to set the date without the time section via LotusScript. 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 below.

'Using this as your sample input
Dim trigger date as string
trigger date = "06/10/2019"

'Use these to set a date only true date field value without the time.
Dim dtmTemp As New NotesDateTime(triggerdate)
Call dtmTemp.setAnyTime            'sets a wildcard for time, thus leaving it the time out
Dim item As NotesItem
Set item = doc.ReplaceItemValue("EntryDate",dtmTemp)

Written by Brendan Dougan

Posted by fbrefere001 on Tuesday June 11, 2019