Search code examples
lotus-noteslotus-dominolotusscript

Getting boolean true if time is between 00.00 and 03.00 AM


Is it possible with lotusscript to get a boolean true if the current time is between 00.00 and 03.00 AM?


Solution

  • Well... there is a tiny, tiny possibility that the time will have ticked across the midnight hour in between operations in this process, and that can throw off the result... But something like this should do the trick:

    dim currentDT as new NotesDateTime
    dim currentDayMidnight as new NotesDateTime("Today 12:00 AM") ' Doc says you can do this, although I never have!
    dim isInRange as boolean
    isInRange = false
    call currentDT.setNow()
    ' check if current time is within 3 hours of midnight
    if currentDT.TimeDifference(currentDayMidnight) <= (3 * 60 * 60) then
      isInRange = true
    end if