How to convert Integer to DateTime?

Hi guys,

I want to know how to convert a number to datetime in Excel just like the feature Excel has does.

For example, 43819 -> 2019/12/20, 43803 -> 2019/12/4.

Thanks in advance!

Maybe trying Invoke Code and use C# so you can use the ‘FromOADate’ function.
Then just pass in your variables

DateTime dt = DateTime.FromOADate(43819);

6 Likes

Hi @Craig_Bannerman

Thanks for your help.

DateTime.FromOADate(43819).ToString(“yyyyMMdd”) => 20191220

I didn’t know what is OADate before this.

Thank you!

No worries dude! I’ve only used it in C# applications so hadn’t personally tried this on UI Path yet - but think it might come handy in future :slight_smile:

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