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.

Year/Week number only on Wednesday through Tues

Featured Replies

Hi

I need a calc to give me the week number preceeded by the last 2 digits of the year ( 2004 =04 or 2010 =10 but the catch is that I need the week to be from each Wednesday through Tuesday and change dynamically. The field for this is called Weeknum

Not sure how to do this?

Any and all your thoughts and expertise very appreciated

Dave

Try something like:

Right(NumToText(Year(status(currentdate))),2) &"_" & if(DayOfWeek(status(CurrentDate)) < 4, WeekofYear(status(currentDate)) - 1, WeekOfYear(status(CurrentDate)))

You may be able to simplify this a bit. This is for FM6 and earlier. For FM7 change the status functions to the equivalent Get functions.

Hi Dave, if i understand correctly, for 2004 Jan 1-6 is week 1, Jan 7-13 is week 2, Jan 14-20 is week 3, ... If that's correct, do this:

firstWed = Date( 1 , 1 , YEAR ) - DayofWeek( Date( 1 , 1 , YEAR ) ) + 4 + ( 7 * ( DayofWeek( Date( 1 , 1 , YEAR ) ) > 4 ) )

WeekID = Truncate( ( ( Date( MONTH , DAY , YEAR ) - firstWednesday ) / 7 ) + 1 , 0 ) + 1

If you want the days before the first Wednesday to be identified as Week 0, just remove "+ 1" from the end of the WeekID calculation. And so,

Weeknum = Right( YEAR , 2 ) & WeekID

Jerry

Echo is quicker on the draw.

I just realized that I did not include a NumToText conversion for the IF function. You should enclose the entire IF function in a NumToText conversion.

Echo

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.