On 07/02/2022 14:48, Ewen Pring wrote:
> Nick Prince <
nick.pr...@gmail.com> sent on 6 Feb 2022:
>
>> there
>> are no dates and times in a spreadsheet, they are just numbers that have
>> been formatted in a certain way.
>
> If you try this- make a new Fireworkz spreadsheet, enter a number
> like 0917 in A1, enter a time 09:17 in A2, enter a date eg 01.10.2022 in
> A3. Save it. Open it in a text editor. You'll see the following relevant
> lines in it;
>
> {S:S;C;0;0;917}
> {S:S;D;0;1;09:17:00;;Time}
> {S:S;D;0;2;01.10.2022;;Date}
>
> So, Fireworkz is actually storing in the file a time and a date formatted
> and categorized as such, rather than (for example) some huge integer
> representing the number of seconds or days since 1900 or similar.
>
Hi all,
Fireworkz does NOT store date/times as floating point numbers, unlike
Excel and friends. As you've demonstrated, the external representation
is indeed textual (and locale-insensitive). Internally it has a two-part
date/time field, one part being days-since-some-datum* and the other
part being a number of seconds. Both parts have one value representing
NULL (absent), but only one part may be absent. There are no separate
date or time types, just that combined date/time.
You can extract an Excel-compatible** floating point serial number from
a date/time using the N() function (and its integer part using INT()),
so you might be able to simulate those functions currently (in 2.00 on)
using:
isdate(A1) -> ("date"=type(deref(A1))) & (0<>int(A1)) & (N(A1)=int(A1))
Is the item referenced by A1 a date/time
AND its number of days is non-zero
AND it has no fractions-of-a-day part?
istime(A1) -> ("date"=type(deref(A1))) & (0=int(A1))
Is the item referenced by A1 a date/time
AND its number of days is zero?
Stuart
* 1.1.0001
** Dates earlier than 01-Mar-1900 do not match as Microsoft Excel
incorrectly believes 1900 to be a leap year.
--
Stuart Swales