(Sorry if this is not the right place to post it!)
In space and navigation, it is very common to use the GPS week and day of the week as a way to write time. It is defined as the number of weeks (starting on Sunday) since Jan 6th 1980. A calendar can be found here. Today, we are in GPS Week 2268.
Adding a new strptime/strftime code for it should be trivial enough, the most difficult part being choosing an unused letter for it. Is it possible, or is it too niche?
Out of curiosity, what’s the standard format for GPS Week? I have used GPS in (non-professional) navigation most of my life and I’ve never seen this format before
Too niche, IMO. There’s plenty of other date-related values (for example, quarter in business use) that have just as credible an argument for inclusion, so it’s difficult to see why any one case deserves preference. The easier approach is to stick with the basically C-compatible set we have right now.
I don’t think so, but I’d typically use f-strings - f"The date is {dt:%Y-%m-%d}", and for that, I’d just use a function - f"The GPS week is {gps_week(dt)}". So for me, a standalone function is perfectly fine.
datetime follows UTC semantics, GPT time does not have UTC semantics: it does not have leap seconds, thus converting from datetime time representation to GPS time is more complex that simply adjusting for an offset in the definition of the epoch. This would make the semantics of a datetime property or method to get the GPS week confusing (and IMHO not that useful).