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.

Featured Replies

Maybe somebody has this calculation somewhere?

I need to calculate the amount of days from a particular year (gYear = 2003)

Anybody?

I'm sure we do, but I'm not sure what the results is suppose to be.

What are you wanting for a result. Number of days from 2003 would be zero. Number of work days left in this 2003 would be 112, Number of days left in 2003 would be 158

Lee

smile.gif

  • Author

Lee,

Result needs to be a number; like: gYear = 2003 (has 365 days) = 365

or the same calculation for the amount of month days: gMonth = March, 2003 (has 31 days) = 31

365 + (not Mod(gYear, 400) or (Mod(gYear, 100) and not Mod(gYear, 4)))

Or for those who prefer less "mathematical" formulations:

Case(not Mod(gYear, 400), 366, not Mod(gYear, 100), 365, not Mod(gYear, 4), 366, 365)

Hmm...

DayOfYear(Date(12,31,gyear)) sounds simple too.

For the Months, I'd go with B)

(Date(gMonth+1, 1, gyear)) - Date(gMonth, 1, gyear)

The number of days per year may also be :

(Date(01, 01, gyear+1)) - Date(01, 01, gyear)

Don't we always say FM has a thousands ways to go... wink.gif

> DayOfYear(Date(12,31,gyear)) sounds simple too.

Forgot about DayOfYear function... that's much better.

> For the Months, I'd go with B)

>

> (Date(gMonth+1, 1, gyear)) - Date(gMonth, 1, gyear)

Or using the same approach as DayOfYear...

Day(Date(gMonth+1, 0, gYear))

> Don't we always say FM has a thousands ways to go...

Indeed... in these cases there are several good ways...

unfortunately in some, the several ways are trade-offs

of the "least of several horrors". wink.gif

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.