Incorrect DATE-OBS/DATE-LOC format in FITS header


Images captured with SGP and Atik 460EX write the DATE-OBS and DATE-LOC fields in the FITS headers in the format '2020-11-09T01.20.21.0000000' when they should be '2020-11-09T01:20:21.0000000' as per ISO 8601.

Could you confirm whether the timestamp comes directly from the camera driver or is it something SGP figures out on its own?

I noticed the problem when stacking images in PixInsight. It shows the following kind of errors during stacking:

*** Error: Parsing DATE-OBS FITS keyword: Parsing ISO 8601 date/time expression: Parsing 64-bit floating point expression: conversion error:

Useful Info

OS: Windows 10

No information about this?

I am not sure. Any other applications that might write to or rewrite FITS headers involved here? SGPro writes FITS dates in the following format: yyyy-MM-ddTHH:mm:ss.fffffff

Even if the camera does supply the date, SGPro is actually responsible for the formatting prior to writing the FITS file out.

Nope, the images are directly coming from SGP. But I have a hunch it is a locale issue. The PC controlling my astrophotography gear has regional formatting set to Finnish, as you can see in the screenshot.


If I change the formatting to English (United States) and capture new images, the FITS dates are in the correct format. So I think some part of the code is using the current locale for formatting the datetime string instead of a constant locale.

Hm, that’s interesting as this is what is formatting the date into the FITs. We’re not using any locale here:


I’ll mess around with my locale and see if I can figure out why this is happening.


A colon is not always a colon. :slight_smile: See documentation for the time format strings assuming your code is in C#: Custom date and time format strings | Microsoft Learn

“:” signifies a time separator, which is culture dependent.


You can supply a format provider to ToString to make sure it always uses the same culture for doing the formatting: DateTime.ToString Method (System) | Microsoft Learn

Were you able to reproduce the problem, given the information I posted?

Yes, I was able to recreate the issue you describe. A fix will be out for testing in the next 4.0 beta.

1 Like