In our Android application, we have a util method for formatting a date to UTC:

```
 static String formatToUTC(Date date) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        return dateFormat.format(date).replace(" ", "T") + "Z";
    }

```

what sometimes produce the value:

> 
> ????-??-??T??:??:??.???Z
> 
> 
> 

To fix the issue we should reproduce it first, but we can't reproduce the behavior.
We were trying different Locales and pass an invalid new Date() from Long.Max\_VALUE, Long.MIN\_VALUE.

The question is:
What can be a reason for this issue?

Thanks in advance!

**Edited:**

The date is Android app generated in two ways:

1. `new Date();`
2. `new Date(longValue)`

The date comes from a worldwide.

**Edited 2:**

The issue appears on a server side (written on a **c#**).

We use [the Ksoap2 for Android](https://github.com/simpligility/ksoap2-android) to interact with a server and it fails sometimes trying to convert **????-??-??T??:??:??.???Z** to a DateTime object.
But main time everything is good.