Getting a compile error trying to create a DateTime

Its Friday afternoon, looks like the Friday afternoon bug :roll_eyes:. Here is the code:

Var d As DateTime = DateTime.Now
Var nextBackup As DateTime 
Var BackupTime() As String = mBackupTime.Split(":") ' For example "23:45" in mBackupTime

nextBackup = New DateTime(d.Year, d.Month, d.Day -1, BackupTime(0), BackupTime(1)) ' Boom

I get “There is more than one method with this name but this does not match any of the available signature”.

The doc says one of the constructor is Constructor(Year as Integer, Month as Integer, Day as Integer, hour as Integer = 0, minute as Integer = 0, second as Integer = 0, nanosecond as Integer = 0, timeZone as TimeZone = Nil)

What I am doing wrong ???

Thanks

You’re feeding strings where integers are expected.

Yes, 3 seconds I posted I figured it out.

Thanks

1 Like

:smile:

Very often the best way to solve a problem. Having to express the problem to another person helps us think through what is happening.

3 Likes