[quote=476271:@Ryan Hartz]I am actually getting errors from the code taken from the docs on these lines
Var d1 As New DateTime(2018, 8, 1, TimeZone.Current)
Var d2 As New DateTime(2015, 3, 1, TimeZone.Current)
When I take out the TimeZone.Current, it will run without error. Is there something up with TimeZone.Current?[/quote]
Nope
But there IS something up with the constructor
Gotta love optional params that arent optional (its a long standing behaviour of “optional” parameters see Optional — Xojo documentation)
Youre providing an int, int, int, timezone and there is NO matching constructor
its
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)
and in this style to pass a timezone you would also need to pass hour, minute, second and nanoeseconds
maybe they need another constructor like
Constructor(Year as Integer, Month as Integer, Day as Integer, timeZone as TimeZone = Nil)
so your code could work
edit : fwiw I made a feature request to support truly optional params (VB 6 style where you could just have commas with no value supplied)
<https://xojo.com/issue/59088>
edit 2: and one for more constructors on date time so your code could work without them having to alter the compiler (this one is nearly as trivial to implement as it gets)
<https://xojo.com/issue/59269>