The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

From 2023: It’s Time For A Change: datetime.utcnow() Is Now Deprecated – miguelgrinberg.com

Posted by jpluimers on 2025/10/14

I forgot how I bumped into this, but a while ago I found this interesting 2023 post: [Wayback/Archive] It’s Time For A Change: datetime.utcnow() Is Now Deprecated – miguelgrinberg.com explaining naive (without time zone) and aware (with time zone) date time objects.

It reminded me of Delphi, where NowUTC – as Delphi does have neither naive or aware date time objects – returns  a floating point value (yes, it has a separate TDateTime type, but it represents the number of days that have passed since December 30, 1899 which in face stems from the Windows OLE Automation era* (OLE Automation is a subset of COM), see [Wayback/Archive] DateTime.ToOADate Method (System) | Microsoft Learn.

That method is mentioned in [Wayback/Archive] Why You Should Use NowUTC Instead of Now in Delphi: A Quick Guide – YouTube and Delphi deserves a way better infrastructure of date and time handling.

So this post is also a reminder to myself: figure out if there is an object oriented DateTime library for Delphi yet, and if not see if there is interest to create one similar to [Wayback/Archive] Noda Time | Date and time API for .NET by Jon Skeet.

Delphi references

Documentation

It look like the docs.embarcadero.com site [Wayback/Archive] Products Documentation – Embarcadero/Idera does not list last Embarcadero products any more, but at least the Delphi 2009 documentation is still there as it has things that are not documented in current versions any more – like the excellent but large index I mention below. Note that Delphi 2009 documentation is incorrect like mentioning TDateTime is a class – it is a typed type, see my 2020 blog post From Delphi 1: Type Compatibility and Identity.

Note their pesty [Wayback/Archive] robots.txt prevents indexing the useful bits:

User-agent: *
Disallow: /products/interbase/IB
Disallow: /products/rad_studio/

Hopefully this index stays online for a while: [Wayback] idx.html (too large to be archived in Archive.is)

Blog posts

In chronological order (they will help me creating such a library if it does not yet exist)

Python references

* Also other tools

Much of the Microsoft world uses this date/time encoding. Which means a lot of products will die in 2078.

And: day zero is 1899-12-30, but why not 1899-12-31?

Well that has to do with a leap year bug that assumed 1900 was a leap year. It was not, so all values before 1900-03-01 needed to be decremented as February 1900 has 28 days instead of the mistaken 29.

This, and the 2078 issue are way better explained at for instance [Wayback/Archive] Why 30th december 1899.

I wrote a short blog post mentioning it and the leap year issue as well in 2014: Excel worksheet function – How do I get the weekday name of a date?

More information:

--jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.