I'm trying to build an arcade expression that evaluates the week number of the year and does a formats the popup a specific way depending on if the week is odd or even. I'm struggling to get this working with arcade as I can't find an equivalent to new Date(now.getFullYear(), 0, 1) to get the first day of the year.
Essentially the logic i am trying to recreate in arcade is
now = new Date();
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
onejan = new Date(now.getFullYear(), 0, 1);
numOfWeek = Math.ceil((((today - firstOfYear) / 86400000)-1)/7);
return(numOfWeek);
I can do the majority of it on my own I'm just not sure of the now.GetFullYear() part. Any assistance is appreciated.
Thanks,
Shawn.
Solved! Go to Solution.
This will return
01 Jan 2018 12:00:00 am |
Date(Year(Now()),0,1)
Perfect thanks Ken! That worked perfectly.
Thanks,
Shawn.