Why date error?

OK, it’s been one of those days. Which brings me to, why am I getting an error on the following:

using xojo.Core

dim dBrandNewDate As New Date(2015,8,1)

The error states: There is more than one item with this name and it’s not clear to which this refers.

I’d say this is a little vague since I have never instantiated a date object with the name dBrandNewDate.

The issue is not with DATE, as your line of code works fine by itself… therefore I suggest that there is something else…

Have you created a method, object or variable that you accidently named DATE?

The TimeZone is required. Try this:

Using Xojo.Core Dim dBrandNewDate As New Date(2015, 8, 1, TimeZone.Current)

What it really means is there is more than one “METHOD” with this name. Your object name is fine. As Paul mentioned you are short a parameter for the Xojo.Date constructor method.

Yes, Paul was correct because with the timezone parameter it worked fine.

Can you instantiate it using the “timezone.secondsfromGMT” because the auto-complete shows that it is available, but using it causes an error. How would you get GMT?

Nevermind… found it in the code sample:

Dim myDate As Date = Date.Now // Get date for current time zone

Dim gmt As New TimeZone(0) // Get GMT time zone
Dim gmtDate As New Date(myDate.SecondsFrom1970, gmt)