setting cookie expiration now that date has been deprecated?

I am trying to use the recommended DateTime object, but when I use this to set the expiration of a cookie, I get the error

“Parameter “Expiration” expects class Date, but this is class Xojo.Core.Date”

This is my code:

Var di As New Xojo.Core.DateInterval(1, 0) // 1 year, 0 months
Var d1 As Xojo.Core.Date = Xojo.Core.Date.Now + di // Get date one year from today
Session.Cookies.Set(“SuzieArtistLevel”, str(WebPage1.iLevel), d1)

Should I use Date even though it has been deprecated since version 2019v2?

Thanks,

John

Keep using date, please.

You are using Xojo.Core.Date, not DateTime. If you use DateTime, your code compiles:

Var di As New DateInterval(1, 0) // 1 year, 0 months Var d1 As DateTime = DateTime.Now + di // Get date one year from today Session.Cookies.Set("SuzieArtistLevel", str(WebPage1.iLevel), d1)

Thank you, Paul - up and running now.