Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6713 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hi there everyone,

Is there perhaps someone who can tell me if there is a way in FM to reverse the date to weeknumber feature?

What we want to do here, is fill in a certain weeknumber of the year x, and then we want FM to return the startingdate and the endingdate of that week.

Is this possible in a way??

(**When the weekofyear function is used, FM is handling the dates to weeknumber just fine, so now the other way arround?? . . .)

Thanking you'll for your reactions,

Bruno

FileMaker Version: 5

Platform: Windows 2000

Posted

Sure, its possible, but you would need to determine what the exact formula is.

Roughly, its going to going to have a structure like:

<date for 1/1/<year>> + (weekNum * 7)

But you'll need to play around with it to get the exact opposite of weekofyear().

  • Newbies
Posted

Thnks Shadow for your reply,

but we're still a bit confused about what you mean

with <date for 1/1<year>> +(weekNum *7)??

Of course we tried several things to turn arround the function,

but nothing seems to work.

The strange thing (and there we also think you are right) is that FM

is capable of sorting out which date is in which weeknumber.

So . . . It has to be possible to display the range (or the first and last) of dates in that weeknumber.

Anyone else sugestions??

Bruno

  • 2 years later...
Posted

Hi,

I am using FM Pro 8 and need to reverse the weekofyear function. I was so excited to find this thread, but when I tried going to the link above from ugo and it is not available.

Can you please help?

Thanks!!

Dales

Posted

FileMaker has no problem with determining the WeekOfYear from the date because it has the date to work with. But when given a number WeekOfYear, FiieMaker has no way of determining what week of what year is being requested and the results would vary according to leap years.

If you have the associated date then you can reverse it ... but ... that's exactly the problem in why you want it ... you don't know the date. But do you know the year? Or can you determine the year from a modification date or some other method?

LaRetta

Posted

These two custom functions can get a date from that week using binary search:

DateForWeekNum( yr; weekNum ) =

If (weekNum >= 1 and weekNum <= 53; DateForWeekSearch( weekNum; Date(1;1;yr); Date(12;31;yr) ); "

DateForWeekSearch( weekNum; startDate; endDate ) =

Let( [midDate = GetAsDate( (startDate + endDate) / 2 );

midWeekNum = WeekOfYear(midDate) ];

case (weekNum < midWeekNum; DateForWeekSearch(weekNum; startDate; midDate );

weekNum > midWeekNum; DateForWeekSearch(weekNum; midDate; endDate ); midDate )

)

If you want the date returned to be the sunday starting the week, you can adjust the DateForWeekNum() function to do that easily enough.

Hope this helps,

This topic is 6713 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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