Hello Team,
How can we manipulate and perform following date based activities
1)Check if Current week is first week of this month
2)Check if current week is it last week of current month
3)Get week no based on date
Example:If date is given 30th jan 2023 then weekNo output should be is 05
Week for year starts from Monday(02-01-2023)
Thanks Team
ppr
(Peter Preuss)
November 1, 2023, 8:05pm
2
in general we can use the following Building Blocks:
Calendar week:
Ensure:
Docu
First Day / Last Day in Month
Modify Date Activity
https://docs.uipath.com/activities/other/latest/workflow/modify-date
or
for the last day, we used the next month and went back 1 day
ppr
(Peter Preuss)
November 1, 2023, 8:12pm
3
When having set the project to WIndows Compatibility we can do:
postwick
(Paul Ostwick)
November 1, 2023, 8:19pm
4
If DateAndTime.Day(Today) <= 7
Get the last day of the month:
DateTime.Parse(Now.AddMonths(1).ToString("MM") + "/01/" + Now.AddMonths(1).ToString("yyyy")).AddDays(-1)
I do it this way because simply filling in the year won’t work if it’s December. You’d end up with the last day of the month for the previous year instead of this year.
Then with that you check if today is within 7 days of the last day of the month:
If DateDiff(DateInterval.Day,Today,DateTime.Parse(Now.AddMonths(1).ToString("MM") + "/01/" + Now.AddMonths(1).ToString("yyyy")).AddDays(-1)) < 7
DatePart(DateInterval.WeekOfYear, Now)
Thanks @ppr and @postwick for the Prompt Response
system
(system)
Closed
November 4, 2023, 8:35pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.