Change Format in Excel (General to Date)

Hello!

I want to convert my number, which i get after I use a formula, to date format. The date should be written as dd.MM.yyyy
image
Thanks.

Try writing the value in excel as DateTime.FromOADate(value you have).ToString(dd.mm.yyyy)

This will write in string format @Loons

1 Like

So I have to read the range/cell, and safe it as value?

no, you don’t have to. How are you reading the values in excel?

If you are using for each row to read the entire data table and to get that particular row value, you can get it as row(“column name”).tostring

and to convert it to string, datatime.FromOaDate(row(“column name”).tostring)).tostring(“dd.mm.yyyy”)

it doesn’t work -.-

TestV2.xaml (18.1 KB) Test cw27 2019.xlsx (390.7 KB)

You want to write the value in AD3 itself?

No, the week number is in AD3. i want to write the date into AD2

TestV2.xaml (18.4 KB)

here it is, it will loop through all the values within the excel and it will write the values to AD2

2 Likes

Thanks for your help, but I don’t think that this is the correct date … the date should be 04.08.2019
image

1 Like

May be i’m passing the value wrong, check it

or in the assign change the last string as tostring(“dd.mm.yyyy”) to “ToShortString”

1 Like

you were almost done
just mention as ToString alone without any arguments and check what value is getting
Cheers @Loons

1 Like

@Palaniyappan

Thank you it works perfectly…but there’s one more problem
How can I get just the date without the time?
image

Mention Toshortdatestring in the place of tostring(format)

1 Like

Or either we can mention like this
datatime.FromOaDate(row(“column name”).tostring)).tostring.SubString(0,10)

Cheers @Loons @HareeshMR

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

Hi ,
Please take look on this link.

Regards
Balamurugan.S