Subject | Re: [firebird-support] How to convert TIMESTAMP to unix timestamp (number of seconds since epoch) |
---|---|
Author | Geoff Worboys |
Post date | 2009-06-09T23:48:19Z |
Hi Sean,
format strings. eg: '2009-06-10T09:44:00+10:00' (actually
the collation is more flexible than that, it also copes with
RFC822 format and some other variations).
(NOT 'EDT', 'EST' and such non-ISO standard abbreviations.)
I cannot claim the original inspiration, the guy running the
project had that, but the idea was to implement our custom
timestamp and decimal data types as ASCII (or UTF8, does not
matter) strings and then use Firebird's custom collation
mechanism to give correct comparison and indexing.
With help from Adriano I got it working, and it works really
well. We have date, timestamp, and time collations and also
a large decimal collation that make it possible to use Firebird
with numbers that may be hundreds of digits long (actually
thousands with some FB-imposed limitations).
The neat thing about using ASCII or UTF8 storage for these
custom types is that the data is directly editable using normal
tools (FlameRobin etc)... but besides the collation you also
need appropriate UDFs to manipulate the values in SQL.
--
Geoff Worboys
Telesis Computing
>> Storing these values as ISO8601 strings, combined with ourI have benn talking about storing timestamps as ISO8601
>> custom collation,
> Custom collation???
format strings. eg: '2009-06-10T09:44:00+10:00' (actually
the collation is more flexible than that, it also copes with
RFC822 format and some other variations).
(NOT 'EDT', 'EST' and such non-ISO standard abbreviations.)
I cannot claim the original inspiration, the guy running the
project had that, but the idea was to implement our custom
timestamp and decimal data types as ASCII (or UTF8, does not
matter) strings and then use Firebird's custom collation
mechanism to give correct comparison and indexing.
With help from Adriano I got it working, and it works really
well. We have date, timestamp, and time collations and also
a large decimal collation that make it possible to use Firebird
with numbers that may be hundreds of digits long (actually
thousands with some FB-imposed limitations).
The neat thing about using ASCII or UTF8 storage for these
custom types is that the data is directly editable using normal
tools (FlameRobin etc)... but besides the collation you also
need appropriate UDFs to manipulate the values in SQL.
--
Geoff Worboys
Telesis Computing