# Why date error?

**URL:** <https://forum.xojo.com/t/why-date-error/22765>\
**Category:** General\
**Created:** [March 2, 2015, 8:51pm UTC](https://forum.xojo.com/t/why-date-error/22765 "2015-03-02T20:51:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Fatte](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/4bbf92/32.png) [@John\_Fatte](https://forum.xojo.com/u/John_Fatte)\
**Post date:** [March 2, 2015, 8:51pm UTC](https://forum.xojo.com/t/why-date-error/22765/1 "2015-03-02T20:51:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [March 2, 2015, 8:56pm UTC](https://forum.xojo.com/t/why-date-error/22765/2 "2015-03-02T20:56:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [March 2, 2015, 8:58pm UTC](https://forum.xojo.com/t/why-date-error/22765/3 "2015-03-02T20:58:32Z")

</div>

The TimeZone is required. Try this:

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

---

<div class="post-metadata">

**Author:** ![Brock\_Nash](https://forum.xojo.com/user_avatar/forum.xojo.com/brock_nash/32/1126_2.png) [@Brock\_Nash](https://forum.xojo.com/u/Brock_Nash)\
**Post date:** [March 2, 2015, 9:03pm UTC](https://forum.xojo.com/t/why-date-error/22765/4 "2015-03-02T21:03:12Z")

</div>

> [@171848:@John Fatte](#):
>
> The error states: There is more than one item with this name and it’s not clear to which this refers.

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.

---

<div class="post-metadata">

**Author:** ![John\_Fatte](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/4bbf92/32.png) [@John\_Fatte](https://forum.xojo.com/u/John_Fatte)\
**Post date:** [March 2, 2015, 9:13pm UTC](https://forum.xojo.com/t/why-date-error/22765/5 "2015-03-02T21:13:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![John\_Fatte](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/4bbf92/32.png) [@John\_Fatte](https://forum.xojo.com/u/John_Fatte)\
**Post date:** [March 2, 2015, 9:16pm UTC](https://forum.xojo.com/t/why-date-error/22765/6 "2015-03-02T21:16:44Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:40pm UTC](https://forum.xojo.com/t/why-date-error/22765/7 "2020-10-29T17:40:27Z")

</div>


