How to convert datetime to integer

I want to get the first business day of the month referencing this video:
UiPath | Get First Working Day | How to get the first working day in month | VB.Net Code

It uses Invoke Code, and the variables are all Integer.
I would like assign the variables as String (or anything other than Int), but I cannot make this code work.

Here’s the code:

Dim dt As New String(Year,Month,Day)

    While True
     Select Case dt.DayOfWeek
     Case DayOfWeek.Saturday,DayOfWeek.Sunday
      Day += Day.AddDays(1).ToString
      dt = New String(Year,Month,Day)
    Case Else
    End Select
   End While


I am stuck in converting data type.

How do i make this code work?

Hello @yesterday

So all you need is to convert the current date, month, year to string, right ?

Please use


These would convert your current date to the respective string formats.

If you have to convert them to Int please use,


and similarly the other 2 as well.

Hope this helps.


Convert.ToInt32 worked.
I was able to make it work.

thank you,

1 Like

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