Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Determining if a year is a leap year

j1fergu
5 - Atom

I used the following formula today to determine if a year was a leap year.  Thought I would share in case others needed this as well.  

 

IF IsInteger([YEAR]/400) THEN "YES" ELSEIF IsInteger([YEAR]/4) AND !IsInteger([YEAR]/100) THEN "YES" ELSE "NO" ENDIF

 

j1fergu_0-1633103520175.png

 

1 REPLY 1
Maskell_Rascal
13 - Pulsar

Hey @j1fergu 

 

Thanks for sharing! Here is the formula I use for finding a Leap Year. 

DateTimeFormat(DateTimeTrim(ToString([Year])+'-02-01','lastofmonth'),'%d')='29'

 

Maskell_Rascal_0-1633106800693.png

 

Since we know that every leap year will have 29 days in February, I use the datetime functions to find the last day Feb for each year. 

 

Cheers!

Phil

Labels