change date to current month notes designer

30 pts.
Tags:
Lotus Notes
LotusScript
Notes Designer
in Notes Designer, I want to change a set future due date, to current month. If it is set to 04/01/09 - the current month is 03 - I want to reset that date. I adust month by -1 and get 02. I adjust by 1 and get 05. and if adust with 0 I get 04. So it never puts it at 03. Here is check and change I am using....dateTime month is 04, lockeddateTime is 03. I get back 02. I have not been able to figure out how to make the month of dateTime = month of lockeddateTime. If Month(dateTime.LSLocalTime) > Month(lockeddateTime.LSLocalTime) Then Call dateTime.AdjustMonth(-1) End If thanks for help Donna

Answer Wiki

Thanks. We'll let you know when a new response is added.

My guess is that because the date has no time, it is evaluating as 3/31/09, instead of 4/1/09. If you can assign a noon time component, it may get the correct month.

I have struggled with date issues, mostly in LS, almost never in @Formula. Maybe someone else has a very specific fix, rather than my general observation/guess?

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Ledlincoln
    I do not experience this with my trial code (below). I think Brooklynegg is on the right track, but maybe your due date field does have a time component, and that is throwing it off due to time zones.
    Sub Initialize
    	Dim datetime As New NotesDateTime("2009-04-01")
    	Msgbox datetime.DateOnly
    	Call datetime.AdjustMonth(-1)
    	Msgbox datetime.DateOnly
    End Sub
    1,620 pointsBadges:
    report
  • tjarman
    I agree with the need for a time component. But what about just extracting the Month from the date, subtracting 1, and rebuild the string? Why subtract 1 though? Are all future dates one month ahead of the current month? If so, the subtracting 1 will work. A more dynamic/generic way would be to determine today's current month. Rebuild the date string with the current month value with the original day and year value. Then if the future month isn't one month in advance, it will still set it to the current month.
    90 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following