Arcade Equivalent of Date getFullYear()

464
2
Jump to solution
09-10-2018 01:33 PM
ShawnRoberts1
Occasional Contributor

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.

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

This will return

01 Jan 2018 12:00:00 am

Date(Year(Now()),0,1)

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

This will return

01 Jan 2018 12:00:00 am

Date(Year(Now()),0,1)
ShawnRoberts1
Occasional Contributor

Perfect thanks Ken! That worked perfectly.

Thanks,

Shawn.

0 Kudos