On Wed, Jun 17, 2020 at 02:24:20AM -0500, Jeff Gray wrote:
> I may be misunderstanding, but is the example in the link declaring a sqlite
> column of type datetime? I didn't think you could do that.
SQLite's typing is different from most other SQL engines. See
https://sqlite3.org/datatype3.html.
I may be misunderstanding, but is the example in the link declaring a sqlite
column of type datetime? I didn't think you could do that.
I just created a person table with four text columns and wrote this in my
playground:
|conn sql bindings|
conn := SQLite3Connection on:
Thanks Pierce. I thought I had to transform them myself. Need to play more...
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
On Mon, Jun 15, 2020 at 01:23:06AM -0500, Jeff Gray wrote:
> Maybe I should just be asking what people normally do to store dates in
> SQLite. (I'm guessing there aren't that many...)
The Pharo SQLite binding stores DateAndTime instances as strings. When
fetching from the database, if the
Wow thanks all. Interesting topic.
I think the short answer I can glean here is use a string.
I wasn't sure as the SQLite doco suggested either string or number and
number felt the right thing to choose.
Clearly not :-)
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Comparing floating-point numbers is perfectly well defined.
Floating point NUMBERS are precise.
Floating point OPERATIONS are approximate.
(See for example the LIA-1 standard.)
In the same way, comparing timestamps *from the same source*
is perfectly well defined.
Considering that light travels
Hi Jeff,
> On 15 Jun 2020, at 09:08, Jeff Gray wrote:
>
> Thanks Steph.
>
> Running a similar experiment using ZTimestamp:
>
> |ts1 ts2|
> ts1 := ZTimestamp now.
> tsNumber := ts1 asUnixTime.
> ts2 := ZTimestamp fromUnixTime: tsNumber.
> Transcript cr; show: ts1.
> Transcript cr; show: ts2.
>
Thanks Steph.
Running a similar experiment using ZTimestamp:
|ts1 ts2|
ts1 := ZTimestamp now.
tsNumber := ts1 asUnixTime.
ts2 := ZTimestamp fromUnixTime: tsNumber.
Transcript cr; show: ts1.
Transcript cr; show: ts2.
I get the output:
2020-06-15T07:05:59Z
2020-06-15T07:05:59Z
--
Sent from:
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
I expect you are right.
I generally won't be looking for an exact match, even down to time. Maybe a
date match, but yes more often it would be greater than less than etc.
Maybe I should just be asking what people normally do to store dates in
SQLite. (I'm guessing there aren't that many...)
--
I know what you mean although with something as ubiquitous as a date, which
may be initiated from a ui control, or initialised to now, or some other
date, like now, or midnight etc, I wouldn't expect to wrap that up in
anything.
It's hard to say as I'm just working on a persistence layer right
Isn't time represented as numbers like floats; it is meaningless to test
for equality. It's only meaningful to test for equality within a
tolerance. This gives the, possibly unexpected, π != π (pi != pi).
The reason is that the first pi could be 3.14 while the second could be
3.14159265358979
Jeff,
I can't comment on the problem per se, as I am not a frequent Pharo user.
But whenever something would be all over the place, I'd suggest thinking
about wrapping the problem into its own class, so that your point in
time is not an instance of DateAndTime but one of your wrapper class.
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
14 matches
Mail list logo