Hi ,
Is there a simple way to get the fist day of the week given a date?
For example, 2016-08-31 would be the input date and the output that I'm looking for would be: 2016-08-29.
Thanks in advance.
Susana
Mine was similar
DateTimeAdd([Field1],-Mod(ToNumber(DateTimeFormat([Field1],"%w"))+6, 7),"days")
@jdunkerley79 Does yours work for dates both sides of your chosen Monday?
Try something like:
DatetimeAdd([date],mod(DateTimeDiff("2016-01-04",[date],"days"),7),"days")
This works out difference from a known Monday and then applies day shift mod 7
@AdamR_AYX probably not, could easily replace with 1900-01-02.
The %w is not documented - http://downloads.alteryx.com/Alteryx8.6.2/WebHelp/Reference/DateTimeFunctions.htm, been hacking round that one with my own addins for ages!
Always nice to learn a new trick
Thanks a lot guys !