LotusScript to Add 1 year to Date/Time Field

Posted on 2011-04-20
Last Modified: 2013-12-18
Hi all,

I'm currently working on a lotus database for storage of information that requires a yearly review.

For the view display purposes, I would like to have a field that will show the date last saved  + 1 year.

Is there any LotusScript that can do this based on the document save date or the date within an existing field?

Question by:QldMatt
    LVL 13

    Accepted Solution

    Dim dateTime as NotesDateTime
    Set dateTime = New NotesDateTime( doc.GetItemValue("datefield")(0)) ' assuming you have already obtained doc
    Call dateTime.AdjustYear(1)
    Call doc.ReplaceItemValue(dateTime.LsLocalTime)
    ' don't forget to save
    LVL 13

    Expert Comment

    If you want to use the last saved date: use doc.LastModified. It'l return a variant.
    LVL 46

    Expert Comment

    by:Sjef Bosman
    View? Column? No lotusScript there. Try

    @Adjust(datefield; 1; 0; 0; 0; 0; 0)

    Author Closing Comment

    Thanks CRAK.

    Added this to the existing Querysave of the form and works well.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
    Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now