Manage Learn to apply best practices and optimize your operations.

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 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.

Code:

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.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close