Brian Dunning's FileMaker Custom Functions

WeekDateISO ( date )

Returns date in extended ISO 8601 week date format.

  Average rating: 4.1 (38 votes) Log in to vote

Michael Horak   Michael Horak
*COMMENT Visual Realisation
http://comment.cjb.net

Share on Facebook Share on Twitter

  Sample input:
Jan 2, 2005
Jan 3, 2005
  Sample output:
2004-W53-7
2005-W01-1

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Returns date in extended ISO 8601 week date format.

The International Standard ISO 8601 extended format representation of week dates is yyyy-Www-d, where W is the actual letter "W", ww refers to the two digit week number, and d is the day's number.

Weeks are represented by two digits beginning with 01 being the first week of the year, up to 52 or 53 being the last week of the year. The first week of a year is the first week that contains four or more days of that year. Weeks start with Monday.

Days are represented by a single digit beginning with 1 being Monday, ending with 7 being Sunday.

This function is not recursive.

 

Comments

Fabrice Nordmann   Fabrice Nordmann, 1-more-thing
Dec 2, 2010
Hi Michael,

what a nice function! I don't dare giving you my previous calculation, it was such a mess compared to yours.

I'm now looking for the reverse function : give a ISO week number and year, and get a date (or a list of dates).
If by chance you have such a thing ready...

Many thanks,
Fabrice
 
comment   comment, VR
Dec 2, 2010
Hi Fabrice,

it shouldn't be very difficult. Hint: January 4 is ALWAYS within week 01.
 
Fabrice Nordmann   Fabrice Nordmann, 1-more-thing
Dec 2, 2010
So simple indeed!
Thanks !
Fabrice
 
comment   comment, VR
Dec 25, 2011
Here's the reverse calculation:

Let (
jan4 = Date ( 1 ; 4 ; ISOyear )
;
jan4 - Mod ( jan4 - 1 ; 7 ) + 7 * ( ISOweek - 1 ) + ISOweekDay - 1
)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.