I have a raster, where the value of a pixel should represent the date at which that pixel was deforested. Dates ranging from 2015 until today. I need resolution to be at the level of day. I would like to be able to perform raster maths on pixels (i.e. show all pixels between two dates), so ISO dates are not appropriate.

What format could I use for dates? I am making a code library so I want to use accepted standards where possible.

I am doing raster processing that needs to be fast (Im using Google Earth Engine JS API). So storing the full unix timestamp as pixel values seems to be overkill. But I presume it needs to be an integer.

Is there a best practice approach for this?

  • 2
    Perhaps Julian day then en.wikipedia.org/wiki/Julian_day.
    – user30184
    Commented Feb 25, 2022 at 7:17
  • Or convert dates to POSIX integer. Commented Feb 25, 2022 at 9:16
  • I guess the kind of processing you will make on your raster should be considered (converting from a custom date format may not be optimal)
    – J.R
    Commented Feb 25, 2022 at 15:25
  • Over what time period and what level of precision (days, months, years)? What software will you use to access the values?
    – user2856
    Commented Feb 26, 2022 at 5:15
  • 2
    +1 for Julian Day. @user30184 you should add that as an answer as the ISO format answer is not very useful. Julian Day fits in the range of UInt16 (0-65,535) raster data type so would take up less space than an ISO format as well.
    – user2856
    Commented Feb 26, 2022 at 5:26

2 Answers 2


I believe the best solution is to use Unix Days (days since epoch, 1st Jan 1970). This can be obtained by millis_since_epoch / 8.64e7. This means we can still use 16bit raster, whereas POSIX date or Unix Timestamp would require a 32-bit raster to store those long values. Julian day is also a good option, but I have no use for the day values between 1 January 4713 and 1 January 1970. In the absence of an accepted standard, Unix Days is the most efficient solution.


I would go for the ISO 8601 format without the dashes, e.g. YYYYMMDD => 20220225

  • 3
    20220301-20220228 is 1 day, not 73 so ISO format wouldn't be suited to all analyses.
    – user2856
    Commented Feb 26, 2022 at 5:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.