How to change month to number

Hello,

I am getting month in alphabets like bleow in excel
image
i need date in below format
2021-02-11
yyyy-MM-DD

how can i achieve this
i need to chnage in each row.

@Mathkar_kunal

outputstr=datetime.parseexact(input,“dd-MMM-yy”,system.globalization.cultureinfo.invariantculture).tostring(“yyyy-MM-dd”)

in the place of input your variable or value to be passed

@Mathkar_kunal

DateTime.ParseExact(“11-Feb-23”,“dd-MMM-yy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)

Hi @Mathkar_kunal

If you want to change the format of date in excel to another format by using the Format cell activity.
In Format cells activity give the range of rows you want to format the cells.
In set format you can select the category and Date format.

Check the below image for better understanding.
image

If you want to use with expression use the below

DateTime.ParseExact(CurrentRow("Start Date").toString,“dd-MMM-yy”,System.Globalization.CultureInfo.InvariantCulture).ToString("dd-MM-yy")

Hope it helps!!

getting each date using get row item and trying to convert
getting below error

@Mathkar_kunal

can you send the value which are passing

and one thing

leftside value should be of string type

outputstr=DateTime.ParseExact(Currentrow(“YourColumnName”).tostring,“dd-MMM-yy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)

got it dont use get row item activity

if are not using for each row in datatable use for each row in datatable

and pass the value as Currentrow(“YourColumnName”).tostring

hope its helps

i need hyphen - in between is that possible using this format cell activity?

No @Mathkar_kunal

It will be with \ only if we will use the format cells activity.

i need - as per requirement

if it is date than how get ro item will take as a string

Sorry @Mathkar_kunal

It will change as per your required, If your local computer have the same format like date with hypen.

Hope you understand!!

@Mathkar_kunal

convert that value to string

output of get row item activity as outputstr

pass it like

DateTime.ParseExact(outputstr.tostring,“dd-MMM-yy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)

now i am reading as a string using read cell

getting this error

@Mathkar_kunal

What is the datatype of FDate it should be string

sdate is generic type i am converting to string using .tostring
but above error

string only

@Mathkar_kunal

Got it

check the value of SDate is in which format like dd-MM-yyyy or dd/MM/yyy

one more thing in excel data is like below
image
when i am reading using get row item which is sdate it is as below

@Mathkar_kunal

DateTime.ParseExact(outputstr.tostring,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy-MM-dd”)

use this now
you will get your output