diff --git a/CHANGELOG.md b/CHANGELOG.md
index c592206..57d78f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # CHANGELOG
 
+## v1.0.5 - 2019/06/01
+
+- Amended the way date formatting is handled - [issue](https://github.com/stuartmccoll/gitlab-changelog-generator/issues/25) raised by [smutel](https://github.com/smutel), commit(s) contributed by [smutel](https://github.com/smutel).
+
 ## v1.0.4 - 2019/03/09
 
 - Amended IP address command line argument to also require the relevant protocol (HTTP/S).
diff --git a/changelog_generator/calls.py b/changelog_generator/calls.py
index 21c184f..2546183 100644
--- a/changelog_generator/calls.py
+++ b/changelog_generator/calls.py
@@ -3,6 +3,8 @@ import logging
 import requests
 import sys
 
+from dateutil import parser
+
 
 logger = logging.getLogger(__name__)
 
@@ -45,10 +47,11 @@ def get_last_commit_date(cli_args: dict) -> str:
         response_json["committed_date"][:-6], "%Y-%m-%dT%H:%M:%S.%f"
     ) + datetime.timedelta(seconds=1)
 
-    return datetime.datetime.strftime(
-        commit_date,
-        f"%Y-%m-%dT%H:%M:%S.%f{response_json['committed_date'][-6:]}",
-    )
+    commit_date = parser.parse(
+        response_json["committed_date"]
+    ) + datetime.timedelta(microseconds=1)
+
+    return datetime.datetime.strftime(commit_date, "%Y-%m-%dT%H:%M:%S.%f")
 
 
 def get_closed_issues_for_project(cli_args: dict) -> dict:
@@ -158,7 +161,7 @@ def get_commits_since_date(date: str, cli_args: dict) -> list:
 
     return sorted(
         clean_response,
-        key=lambda x: datetime.datetime.strptime(
-            x["committed_date"][:-6], "%Y-%m-%dT%H:%M:%S.%f"
+        key=lambda x: datetime.datetime.strftime(
+            parser.parse(x["committed_date"]), "%Y-%m-%dT%H:%M:%S.%f"
         ),
     )
diff --git a/setup.py b/setup.py
index 8c4cd08..dd09982 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
 
 setuptools.setup(
     name="gitlab-changelog-generator",
-    version="1.0.4",
+    version="1.0.5",
     author="Stuart McColl",
     author_email="it@stuartmccoll.co.uk",
     description="A small command line utility for generating CHANGELOG.md "
@@ -18,7 +18,7 @@ setuptools.setup(
         "console_scripts": ["changegen=changelog_generator.entry_point:main"]
     },
     packages=setuptools.find_packages(),
-    install_requires=["requests"],
+    install_requires=["requests", "python-dateutil"],
     tests_require=["unittest", "mock"],
     classifiers=(
         "Environment :: Console",

Issue with date format
Hello,

When executing gitlab-changelog-generator, I get this issue:
`ValueError: time data '2019-04-15T08:58:4' does not match format '%Y-%m-%dT%H:%M:%S.%f'`

In DEBUG we can see the dates like:
```
'committed_date': '2019-04-15T08:58:44.000Z'
'authored_date': '2019-04-15T08:58:44.000Z'
```

Thanks for your help.
diff --git a/changelog_generator/tests/test_calls.py b/changelog_generator/tests/test_calls.py
index 0024e2f..2147a0a 100644
--- a/changelog_generator/tests/test_calls.py
+++ b/changelog_generator/tests/test_calls.py
@@ -54,7 +54,7 @@ class TestCalls(unittest.TestCase):
         }
 
         commit_date = get_last_commit_date(cli_args)
-        self.assertEqual(commit_date, "2018-06-10T14:01:45.000000+00:00")
+        self.assertEqual(commit_date, "2018-06-10T14:01:44.000001")
 
     @mock.patch("sys.exit")
     @mock.patch("changelog_generator.calls.requests.get")

pip install -e .[dev]
parse_log_pytest
pytest
pytest mock python-dateutil
apt-get update apt-get install -y gcc
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
-e git+https://github.com/stuartmccoll/gitlab-changelog-generator.git@960b021e38ed32f8e973b7752c178d92ae1128a1#egg=gitlab_changelog_generator
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mock==5.2.0
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
python-dateutil==2.9.0.post0
requests==2.31.0
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
urllib3==2.0.7
zipp @ file:///croot/zipp_1672387121353/work

name: gitlab-changelog-generator
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=22.1.0=py37h06a4308_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - importlib-metadata=4.11.3=py37h06a4308_0
  - importlib_metadata=4.11.3=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=22.0=py37h06a4308_0
  - pip=22.3.1=py37h06a4308_0
  - pluggy=1.0.0=py37h06a4308_1
  - py=1.11.0=pyhd3eb1b0_0
  - pytest=7.1.2=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py37h06a4308_0
  - typing_extensions=4.4.0=py37h06a4308_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.11.0=py37h06a4308_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==3.4.1
      - idna==3.10
      - mock==5.2.0
      - python-dateutil==2.9.0.post0
      - requests==2.31.0
      - six==1.17.0
      - urllib3==2.0.7
prefix: /opt/conda/envs/gitlab-changelog-generator

changelog_generator/tests/test_calls.py::TestCalls::test_get_last_commit_date
changelog_generator/tests/test_calls.py::TestCalls::test_commits_since_date changelog_generator/tests/test_calls.py::TestCalls::test_get_closed_issues_for_project changelog_generator/tests/test_calls.py::TestCalls::test_get_last_tagged_release_date changelog_generator/tests/test_calls.py::TestCalls::test_unsuccessful_commits_since_date changelog_generator/tests/test_calls.py::TestCalls::test_unsuccessful_get_last_commit_date
setup.py changelog_generator/calls.py CHANGELOG.md
setup.py changelog_generator/calls.py CHANGELOG.md