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
Solved! Go to Solution.
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
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?
@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 !
Hi @jdunkerley79, please see our revised Date/Time Functions help page in the current release of the online help. You'll see that %w is now documented under the Format Specifiers, Separators, and Examples section.
If you have any feedback on this help page, please send it our way at helpfeedback@alteryx.com. Thanks!
-Kris Vickland
Technical Writer