Repository: sunpy/sunpy

Issue:
The submitted times don't match returned times when using get_horizons_coord  with dictionary time argument
### Describe the bug

When specifying the times as a dictionary the milliseconds are not being passed to the underlying astroquery call (the documentation suggest it doesn't support them but it does) and this results in the time being slightly off expected values. Possibly also need an upstream fix for the docs (https://astroquery.readthedocs.io/en/latest/api/astroquery.jplhorizons.HorizonsClass.html#horizonsclass)

A solution is to pass the full time string to astroquery by changing 

https://github.com/sunpy/sunpy/blob/64419c2d335695bf99d9a1ebdb457d3d47b22bc5/sunpy/coordinates/ephemeris.py#L306

to `jpl_fmt = '%Y-%m-%d %H:%M:%S.%f`

### To Reproduce

```
from sunpy.coordinates import get_horizons_coord

so_coords = get_horizons_coord('-144', time={'start': '2023-07-01T00:00:00.000',
                                             'stop': '2023-07-01T00:00:00.000', 'step':'1h'})

so_coords.obstime.utc.isot
# array(['2023-06-30T23:59:59.816', '2023-07-01T00:59:59.816'], dtype='<U23')
# expected this to match input time 2023-07-01T00:00:00.000, 2023-07-01T00:00:00.000
```


with the above suggested fix 
```
from sunpy.coordinates import get_horizons_coord
so_coords = get_horizons_coord('-144', time={'start': '2023-07-01T00:00:00.000',
                                             'stop': '2023-07-01T01:00:00.000', 'step':'1h'})
so_coords.obstime.utc.isot
# array(['2023-07-01T00:00:00.000', '2023-07-01T01:00:00.000'], dtype='<U23')
```


### Screenshots

_No response_

### System Details

### General

OS: Mac OS 13.4
Arch: 64bit, (arm)
sunpy: 5.0.0
Installation path: /Users/sm/.virtualenvs/radiospectra/lib/python3.9/site-packages/sunpy-5.0.0.dist-info

### Required Dependencies
astropy: 5.3
numpy: 1.25.0
packaging: 23.1
parfive: 2.0.2

### Installation method

_No response_


Discussion:

Resolving patch:
diff --git a/sunpy/coordinates/ephemeris.py b/sunpy/coordinates/ephemeris.py
--- a/sunpy/coordinates/ephemeris.py
+++ b/sunpy/coordinates/ephemeris.py
@@ -18,6 +18,7 @@
     CartesianRepresentation,
     SphericalRepresentation,
 )
+from astropy.time import Time
 
 from sunpy import log
 from sunpy.time import parse_time
@@ -303,7 +304,7 @@ def get_horizons_coord(body, time='now', id_type=None, *, include_velocity=False
         if set(time.keys()) != set(['start', 'stop', 'step']):
             raise ValueError('time dictionary must have the keys ["start", "stop", "step"]')
         epochs = time
-        jpl_fmt = '%Y-%m-%d %H:%M:%S'
+        jpl_fmt = '%Y-%m-%d %H:%M:%S.%f'
         epochs['start'] = parse_time(epochs['start']).tdb.strftime(jpl_fmt)
         epochs['stop'] = parse_time(epochs['stop']).tdb.strftime(jpl_fmt)
     else:
@@ -326,7 +327,8 @@ def get_horizons_coord(body, time='now', id_type=None, *, include_velocity=False
     log.debug(f"See the raw output from the JPL HORIZONS query at {query.uri}")
 
     if isinstance(time, dict):
-        obstime = parse_time(result['datetime_jd'], format='jd', scale='tdb')
+        obstime_tdb = parse_time(result['datetime_jd'], format='jd', scale='tdb')
+        obstime = Time(obstime_tdb, format='isot', scale='utc')
     else:
         # JPL HORIZONS results are sorted by observation time, so this sorting needs to be undone.
         # Calling argsort() on an array returns the sequence of indices of the unsorted list to put the


Test patch:
diff --git a/sunpy/coordinates/tests/test_ephemeris.py b/sunpy/coordinates/tests/test_ephemeris.py
--- a/sunpy/coordinates/tests/test_ephemeris.py
+++ b/sunpy/coordinates/tests/test_ephemeris.py
@@ -1,6 +1,7 @@
 
 import pytest
 from hypothesis import HealthCheck, given, settings
+from numpy.testing import assert_array_equal
 
 import astropy.units as u
 from astropy.constants import c as speed_of_light
@@ -126,6 +127,9 @@ def test_get_horizons_coord_dict_time():
     e = get_horizons_coord('Geocenter', time_dict)
     e_ref = get_horizons_coord('Geocenter', time_ref)
 
+    assert e.obstime.format == 'isot'
+    assert e.obstime.scale == 'utc'
+    assert_array_equal(e_ref.obstime.utc.isot, e.obstime.utc.isot)
     assert_quantity_allclose(e.lon, e_ref.lon, atol=1e-9*u.deg)
     assert_quantity_allclose(e.lat, e_ref.lat)
     assert_quantity_allclose(e.radius, e_ref.radius)