How to Excel display Date Format

엑셀 셀에 날짜 입력을 하면 숫자로 변합니다.
input Date : “2019-03-07”

Exchanged : 43531

엑셀 표시형식을 날짜 형식으로 지정할 수 있나요?
엑셀 표시형식을 컨트롤하는 방법이 궁금합니다.

1 Like

datetime.FromOADate(“exchanged date”)

@sumouse

thank you.
but, im not understand.

“exchanged date” is string?

I saw parameter.
parameter is ‘d as Double’

i have date format tha it is string format now

That will be a numeric or double value. When you want to convert the exchanged to actual date, use this @sumouse

datetime.FromOADate(CDbl(“exchanged date”))).Tostring

thank you.
I will try.

try result

Error…Help ^^
Conversion from string “2019-03-07” to type ‘Double’ is not valid.

Can you confirm whether you want to change input string to exchanged or exchanged to input string @sumouse

string : “2019-03-07” => datatable(String) => write excel cell

Yeah, as the default type of the cells in excel is number or text, write cell will convert the date to number and then it will write the value. So, convert the cells to date and then write the value

I already know that. But Excel sheets are difficult because they are newly made in uipath.

Fine if the input string is
input Date : “2019-03-07”

Then while entering in write cell try with this by adding a single quotes before to the string we have
So that it would enter as string without changing the format
“‘“ + yourinputvariable.Tostring

Cheers @sumouse

yes, i know ^^;; hahaha.

I was wondering if there was any activity or method provided by uipath.

1 Like

You can use Format(date, “dd-mm-yyyy”) while writing @sumouse

Not sure if there any other activities

Hmm no I don’t think so
We can usually maintain the format of the value we right in excel with these kind of string manipulation
May be we got a property like Preserve Format while using read and write range activity
But that works to certain extent only and especially not to the date format

Cheers @sumouse

Thank you for your interest.

Thank you for your interest.

^^

1 Like

No worries
Do we have any other queries to be discussed buddy
Cheers @sumouse

Hi @sumouse

it happened while reading excel sometime.
The double values which you are getting are OLE Automation Dates.

Excel interop dates are stored as Integers.It is possible to convert them to DateTimes.
We use FromOADate to convert OLE Automation Dates to real DateTime values by using Datetime.FromOADate().ToString(“yyyy-MM-dd”) //formate you can change as per your need.

Excel stores dates as sequential numbers and it is only a cell’s formatting that causes a number to be displayed as a datetime or date.

so in your case 2019-03-07 43531 days after 1-01-1900

Regards…!!
Aksh