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
- [Wayback/Archive] System.TDateTime – RAD Studio API Documentation
- [Wayback/Archive] System.DateUtils.TDateTimeHelper.NowUTC – RAD Studio API Documentation
- [Wayback/Archive] Data.DB.TDateTimeAlias – RAD Studio API Documentation
- [Wayback/Archive] Data.DB.TDateTimeRec – RAD Studio API Documentation
- [Wayback/Archive] TDateTime Class
- [Wayback/Archive] DB.TDateTimeAlias Type
- [Wayback/Archive] DB.TDateTimeRec Record
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)
- ISO 8601: Delphi way to convert XML date and time to TDateTime and back (via: Stack Overflow)
- ISO 8601 Date, Time and DateTime in Delphi (was: Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool)
- Excel worksheet function – How do I get the weekday name of a date?
- Delphi – Direct3D and the wrong FPU state: Now() function returns a wrong value (via: StackOverflow)
- Delphi: rolling your own code or (dis)trusting the libraries that ship with Delphi?
- NHibernate, LINQ, Oracle and the placement of Take: avoid “Specified method is not supported.”
- Date format converter from Text or Unix/Mac/Filetime/Microsoft to virtually any readable form
- Firebird – adjusting Delphi stored TDateTime (or OLE Automation date) fields that contain Dates, Times or DateTimes
- A slightly optimized TDateTime functions (YearOf, MonthOf, DayOf) …
- Firebird: the way you compare dates highly influences fetch times
- More Delphi debug visualizers
- Delphi, compiler intrinsics and generic type matching
- From Delphi 1: Type Compatibility and Identity
- Delphi XE6 and up regression: “‘9999-12-31 23:59:59,1000’ is not a valid date and time” when passing a SOAP message with 9999-11-31T23:59:59.9999999; QC144171
- Delphi: get timestamp as ISO8601 string for use in filenames
- Since Delphi still does not include a TDateTimeHelper: use the one by colini which has tests
- How to quickly add hours/minutes/second to date and time in Excel?
- Delphi: workaround doing math with generic types preventing “E2015 Operator not applicable to this operand type” with TValue (as there is no way to constraint the generic type to be floating point or ordinal)
- datetime – What is the difference between UTC and GMT? – Stack Overflow
Python references
- [Wayback/Archive] What’s New In Python 3.12 — Python 3.13.2 documentation
- [Wayback/Archive] datetime — Basic date and time types — Python 3.13.2 documentation
* 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:
- Unix Epoch – Wikipedia
- December 30, 1899 (Saturday) – Wikipedia
- System time: Programming languages and applications – Wikipedia
--jeroen






Leave a comment