Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding a year minus one day to a date.

Featured Replies

Hi everyone... got a simple yet no so simple question... what would be the script to add a year minus one day to a date? Like in insurance policies which expire one year less a day from the day you bought it? Seems complex because some months have 31 days.. some 30, some 29 on leap years n 28 on other....

Thanks!

CAN YOU JUST ADD 364 DAYS...?? Please show your script so we can help you..

Actually, adding 364 days is not the answer due to leap years. Try adding:

Date ( Month ( StartDate ) ) ; Day ( StartDate ) ; Year ( StartDate ) ) -1

where: StartDate is the start of the policy.

Small change - you forgot to add one year. :^)

Date ( Month ( StartDate ) ; Day ( StartDate ) ; Year ( StartDate ) + 1 ) -1

OK, revision, this seems to work, let me know..

Case(

Day ( startdate-1 ) >Day ( startdate ) ; Date ( Month ( startdate )-1 ; Day ( startdate-1 ) ; Year ( startdate ) +1);

Day ( startdate-1 ) < Day ( startdate );Date ( Month ( startdate ) ; Day ( startdate-1 ) ; Year ( startdate ) +1))

You missed adding a year and you have an extra ) after month

Date ( Month ( AnyDate ) ; Day ( AnyDate ) ; Year ( AnyDate ) + 1) -1

update, must be a slow day around the offices. LOL :giggle2:

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.