How to convert month text format?

image
how to find month in text format in month column kindly share your knowledge

@domsmgtmeet22,

Tried this approach?

its not working sir…

Would you specify what’s not working or error. We can make it work.


showing this error

@domsmgtmeet22,

You need to save the code into a text file in your project folder then pass that file name here.

and in place of "Main" pass "Macro1"

Hie @domsmgtmeet22 hope this help you
your process
The image depicts a workflow from a data processing application with steps to build a data table, iterate through its rows, assign values, convert date formats, and log messages. (Captioned by AI)

your input

inside for each row use this
save your row value in a variable
image

your convert logic

finally your output
The image displays the output log of a debugging session, showing the start and end of the "Standard_Cost_Approval_Data" execution process along with a list of months from January to June. (Captioned by AI)

Note: this two variable that i create inside the for each is of string type
also change your date format as per your logic

cheers Happy Automation


kindly assist me

Hi @domsmgtmeet22

Can you try below

For Each row As DataRow In dt.Rows
    row("Month") = DateTime.ParseExact(row("PO Date").ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MMMM")
Next

Regards,

@domsmgtmeet22

Download this code and configure your activity as per it.

https://www.uipath.com/hubfs/Activities/InvokeVBA%20Example.zip

Can you Show me the Output Date Format of po_date variable like use log message for the po_date variable and show the extract data i need to view the format

show an log message but its not write datatable

after the po_date use log message and comment out the 2 assign variable and run the process then it will show the output

i see log message output its correct. but its not write datatable

Actually i want to see your Output format because when i try it will give me the data like this

but i have to convert it to this first


Actual data is coming in this format from excel
The image shows a list of execution logs for "Standard_Cost_Approval_Data" with entries for "With Split Value" and "Without Split Value" spanning from 01/05/2024 to 07/05/2024. (Captioned by AI)
you can see the difference
try this method

Summary: i think while bot read the data from the excel it also take the hour:minute:second also from so first we have to split so we can only get the time and extract the month
cheers

1.First Read The Sheet, you will get output as data Table.
2. Now use For each row in datatable Activity and pass the Dt .
3. Now take one assign , In that create one string type variable
For eg: str_date = currentrow(“PO Date”).tostring.Split(" "c)(0)
4. Now create another string type varible
For Eg : str_Month = DateTime.ParseExact(str_date,“MM/dd/yyyy”,Nothing).tostring(“MMMM”)
5. Now take one assign
currentrow(“Month”)=str_Month

This will Update Month Column
Please Refer Below Screenshot:

If you like my solution please mark it as solution. Thanks :blush:

@domsmgtmeet22
Try with the below sequence:
newdate = DateTime.ParseExact(inputDate, “dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)
monthName = parsedDate.ToString(“MMM”)

Use this inside for each row activity and as an input date pass the value present foreach row.
Thanks ,
Jagravi