How to use Switch Activity in version 2025 after 4 June update. Here I want to switch each month name into its number. Like January will be 01, February will be 02, and so on. But how can I do this through the Switch Activity latest version as it is totally confusing.
just click on “Add Case” and enter your condition (e.g., “January”, “February”, etc.) in each case block. Then assign the corresponding value (like “01”, “02”, etc.) inside the respective case.
Attached is my working solution for reference.
BlankProcess15.zip (38.3 KB)
Hi @Zoobi_Products
Welcome to UiPath
set the expression to your month name variable like monthName. change the type argument to string. then add cases for each month name like “january”, “february”, etc. inside each case, assign the corresponding number string like “01”, “02”, and so on. use a default case if needed for unmatched values.
If you found helpful please mark as a solution. Thanks
Happy Automation with UiPath
Welcome to the community
if the requirement is to get the month number using name then you can simply use the below formula
DateTime.ParseExact(MonthName, "MMMM", CultureInfo.CurrentCulture ).Month
cheers
Thank you so much all. This was not working for me but now it’s working well and I got it as normal. Thanks all
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.