Getting current week number

Hi ,

Currently ,l am working to automate sending emails on weekly basis (using Ui Path Studiox)

So, l want to automate getting the current week number to use it in email subject or body as showen below.

I had been search online and solutions using Ui Path Studio was found ,but i using StudioX

Kindly support

Import System.Globalization


How about the following?

(new System.Globalization.CultureInfo("en-US").Calendar).GetWeekOfYear(Save_result_as_DateTime_from_Modify_Date,System.Globalization.CalendarWeekRule.FirstDay, System.DayOfWeek.Sunday)

Please use AdvancedEditor to set the above expression.


1 Like

Hi @Mariam_Al_Ashwan

Kindly use the below expression to get the week of the year.

num_Week(int32) = DateDiff(DateInterval.WeekOfYear,Cdate(“01-01-2023”), now.Date)


Another Expression that you can try:

num_Week(double) = Math.Floor(Now.DayOfYear/7)

Ashvani Kumar

I really appreciate your help thank you.

1 Like

Thank you sir for your time.

but here are some notes, the second expression is working but it shows number 3, but the current week is 4.

the first expression shows an error for me.

Hi @Mariam_Al_Ashwan

Just need to change .Floor to .Ceiling and the expression will work.

num_Week(double) = Math.Ceiling(Now.DayOfYear/7)


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.