Hello guys, Can anyone help to find if the dates in excel are leap year or not then update the status to a new column of same excel sheet
Hi @Goku
Check the below workflow of leap year
year Mod 400 = 0 and not year Mod 4 = 0 and Not year Mod 100= 0
In the above condition year is a variable
Hope it helps!!
Another option (in case this is not a practice assignment), would be to use the DateTime.IsLeapYear method.
DateTime.IsLeapYear(Int32) Method (System) | Microsoft Learn - https://learn.microsoft.com/
HI @Goku
Try with this syntax
year Mod 4 = 0 And year Mod 100 <> 0
Check out this Video link
Regards
Gokul
we can use the isLeapYear method
first line: demo
second line: convert the date from Excel into a DateTime e.g. with CDate and pass it to the isLeapYear method
Hey @Goku ,
You can read the excel , then using for each row in DataTable activity iterate through each row and get the dates
The dates u get will be in string format , convert it into required format and then extract the year out of it
After getting the year use the below condition in if Activity
((Cint(CurrentYear) mod 4 = 0 ANDALSO Cint(CurrentYear) mod 100 <> 0) ORELSE Cint(CurrentYear)mod 400 = 0 )
Then add it to the datatable and then write it back to excel
I have uploaded the file below for your reference
New folder.zip (11.4 KB)
And the output screenshot is below
Hope it helps you out!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.