find 6 months, ahead or back - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

find 6 months, ahead or back

Last post 01-23-2020 08:07 AM by granDelimiter. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-22-2020 03:28 PM

    find 6 months, ahead or back

    Hi, Here's a question that should be fun. I want to set a date field to a date 6 months in the future. I see posts about subtracting date/times that look extremely hard and complicated. I only need the number of months. I suppose it will involve extracting the year and the month separately and using a formula. Does the extration have to be to txt? (numbers might be more useful) If so, can I convert them back to numbers? Has anyone done this? Thanks,
  • 01-22-2020 06:52 PM In reply to

    Re: find 6 months, ahead or back

    Update: I got extracting year (and month) as numbers: YEAR(dateField), leaving datatype as number. After I do my math, how do I insert the new number into a date field?
  • 01-23-2020 07:36 AM In reply to

    Re: find 6 months, ahead or back

    Dates are formatted yyyy-mm-dd in XML. Date time fields are formatted yyyy-mm-ddTHH:MM:SS. So if you are populating a date field, you'd use a concat formula to put your numbers in, separated by hyphens, like 2020-01-23. If you need a date time, because your field is a date time field, you can use 0s for the time, like 2020-01-23T00:00:00.
    Hilary Stoupa

  • 01-23-2020 08:07 AM In reply to

    Re: find 6 months, ahead or back

    Thanks Hilary, I see now that SharePoint makes it easy to add months to a date, and integrates it even for leap years in a calculated column: =DATE(YEAR(originalDate),MONTH(originalDate)+6,DAY(originalDate)) More on formulas at: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/bb862071(v%3Doffice.14)#date-and-time-formulas. I wouldn't have found it without your forum to think out loud in.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.