Hi jeff I do not have the exact answer and too busy now. My impression that is printString is not what we want. I want a ( DatePrinter on: DateAndTime now) printIso; noMicrosecond; noTimezone; print Because your printString will certainly not work with my needs? Now I got no time to work on this but this would be a great project. So instead of bloating dateAndTime and friends I would separate it. Did you have a look at the ZTimeStamp project of Sven? Because I remember he got some facilities but my memory is to vage. S.
On 15 Jun 2020, at 06:44, Jeff Gray <jeff@rogerthedog.com> wrote:
Hi all. In Playground I write these lines:
Transcript cr; show: DateAndTime now printString. Transcript cr; show: (DateAndTime fromSeconds: (DateAndTime now asSeconds)) printString.
and in the Transcript window I get these results:
2020-06-15T14:33:06.630367+10:00 2020-06-15T14:33:06+10:00
I was expecting these two to be the same.
I was hoping to use DateAndTime fromSeconds: and aDateAndTime asSeconds to convert a DateAndTime to/from a number in order to store it in SQLite, but I don't like the way the nanos are dropped using this method. It's all good if I remember to call DateAndTime now truncated, and drop the nanos myself, but that might be all over the place in my application.
Instead, is there a better way to convert a DateAndTime to and from a number?
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France