# Error using Java API to update list filters

**URL:** <https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [June 12, 2019, 3:48pm UTC](https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759 "2019-06-12T15:48:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mclayton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mclayton/32/34870_2.png) [@mclayton](https://community.hubspot.com/u/mclayton)\
**Post date:** [June 12, 2019, 3:48pm UTC](https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759/1 "2019-06-12T15:48:42Z")

</div>

I am attempting to update a filter daily, using the Java API.

The field is a date field, called **membership\_end\_date**.

When I attempt to do this using java, I get this error message:

`Dates with greater than filters must specify the end of the day as the timestamp`

My date, in milliseconds, is set to the end of the current day:

`1560398399999`

Which, in plain text, is…

`Wed Jun 12 23:59:59 EDT 2019`

Here is my JSON:

```auto
{
 "name": "Active Members List",
 "filters": [
 [
 {
 "withinTimeMode": "PAST",
 "filterFamily": "PropertyValue",
 "property": "membership_end_date",
 "type": "date",
 "value": 1560398399999,
 "operator": "IS_NOT_EMPTY"
 },
 {
 "withinTimeMode": "PAST",
 "filterFamily": "PropertyValue",
 "property": "membership_end_date",
 "type": "date",
 "value": 1560398399999,
 "operator": "GT"
 },
 {
 "withinTimeMode": "PAST",
 "filterFamily": "PropertyValue",
 "property": "current_membership",
 "type": "string",
 "value": "Membership",
 "operator": "CONTAINS"
 }
 ]
 ]
}

```

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [June 12, 2019, 9:10pm UTC](https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759/2 "2019-06-12T21:10:58Z")

</div>

Hi, @mclayton.

HubSpot accepts [epoch timestamps in UTC (0:00)](https://developers.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis), so I think the issue is that `1560398399999` comes out to **Thursday, June 13, 2019 at 03:59:59.999 UTC**.

Could you try `1560383999999`?

---

<div class="post-metadata">

**Author:** ![mclayton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mclayton/32/34870_2.png) [@mclayton](https://community.hubspot.com/u/mclayton)\
**Post date:** [June 14, 2019, 4:53pm UTC](https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759/3 "2019-06-14T16:53:37Z")

</div>

I’m generating this timestamp with Java.

```auto
1560571199999
Fri Jun 14 23:59:59 EDT 2019

```

Also, 1560398399999 comes out to Wed 12 June 2019  
23:59:59 when I use an online date converter.

Check your numbers again?

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [June 14, 2019, 5:28pm UTC](https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759/4 "2019-06-14T17:28:33Z")

</div>

Hi, @mclayton.

My numbers are correct. You must use a timestamp that reflects 23:59:59.999 in **UTC/GMT 0:00** on the desired date, _not_ 23:59:59.999 in your local time zone (e.g. **EDT** ,or **UTC -4:00** ).

When I attempt to update one of my own list filters with the EDT timestamp `1560916799999` ( **Tuesday, June 18, 2019 at 23:59:59.999** **EDT)**:

```auto
{
 "filters": [
 [
 {
 "withinTimeMode": "PAST",
 "operator": "GT",
 "filterFamily": "PropertyValue",
 "type": "date",
 "property": "custom_date_picker",
 "value": 1560916799999
 }
 ]
 ]
}

```

… I receive the following error:

```auto
{
 "status": "error",
 "message": "Dates with greater than filters must specify the end of the day as the timestamp",
 "correlationId": "fb2eba9a-6015-427c-9989-7cbeae9fced0",
 "requestId": "eda7e04e7010e7959ae4ad6cce1d39a1"
}

```

However, when I use a timestamp reflecting **Tuesday, June 18, 2019 at 23:59:59.999** in the **UTC/GMT** time zone — `1560902399999`:

```auto
{
 "filters": [
 [
 {
 "withinTimeMode": "PAST",
 "operator": "GT",
 "filterFamily": "PropertyValue",
 "type": "date",
 "property": "custom_date_picker",
 "value": 1560902399999
 }
 ]
 ]
}

```

…I receive a `200` response and the update takes.

---

<div class="post-metadata">

**Author:** ![mclayton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mclayton/32/34870_2.png) [@mclayton](https://community.hubspot.com/u/mclayton)\
**Post date:** [June 14, 2019, 6:28pm UTC](https://community.hubspot.com/t/error-using-java-api-to-update-list-filters/14759/5 "2019-06-14T18:28:15Z")

</div>

Seems to be working.

Only thing I did differently was to setTimeZone(…)

Thanks @IsaacTakushi

```auto
Date day = new Date();
	 Calendar cal = Calendar.getInstance(); 
	cal.setTime(day);
	 cal.set(Calendar.HOUR_OF_DAY, cal.getMaximum(Calendar.HOUR_OF_DAY));
	 cal.set(Calendar.MINUTE, cal.getMaximum(Calendar.MINUTE));
	 cal.set(Calendar.SECOND, cal.getMaximum(Calendar.SECOND));
	 cal.set(Calendar.MILLISECOND, cal.getMaximum(Calendar.MILLISECOND));
	 cal.setTimeZone(TimeZone.getTimeZone("UTC"));

```
