How to convert the System.DateTime.Now.ToString into integer?

Already tired with C(int) and integer.parse


Welcome to the UIpath Community.

May I know why you are trying to convert it to interger. It won’t give proper result.

1 Like

Hi @Shiva3516

I wonder why you want to convert it to it… but I have a guess that you want to convert it to a format something like 20190606 without slashes and dashes. In that case convert it to a string. Not to int. Convert using


Also, you can convert the datetime to a numerical value that can be used for calculations or other things in a few other ways:

Now.ToOADate will give you the 40000 number similar to Excel. Each day that number increments by one

Now.Ticks will give you a Long type value that’s based on how many programmatic ticks were made during the datetime. This can be used to calculate total seconds too I believe.

(Now.ToUniversalTime - New DateTime(1970, 1, 1)) will give you a timespan, then you can add .TotalSeconds, .TotalMilliseconds, or .TotalMinutes, etc for a numerical value

So those are some other ideas.