I don't know the new datetime2 package, but probably it depends on primitives such as \pdfcreationdate, and \pdffilemoddate. At present they are only in the pdfTeX engine.
eptex and euptex also have the primitives. Best, Akira -------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
