![]() |
#16 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
7 Mar 2021 (calibre 5.13):
Last edited by chaley; 03-11-2021 at 02:55 PM. |
![]() |
![]() |
![]() |
#17 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
11 Mar 2021 (in calibre source):
Last edited by chaley; 03-13-2021 at 03:12 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
20 Mar 2021 (in calibre source):
Last edited by chaley; 03-20-2021 at 09:38 PM. |
![]() |
![]() |
![]() |
#19 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
24 Mar 2021 (in calibre source)
|
![]() |
![]() |
![]() |
#20 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#21 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() Code:
if $line =~ /^firstweek: *(.*)/ then Code:
<?GPM echo bgcolor($ForumTableHeaderColor); ?> Code:
HCF(0x9D) ![]() |
|
![]() |
![]() |
![]() |
#22 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,063
Karma: 69102175
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#23 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
26 Mar 2021 (in calibre version 5.14)
|
![]() |
![]() |
![]() |
#24 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,063
Karma: 69102175
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: Is there a way to set an arbitrary epoch? I can see some strangeness otherwise, e.g. if to_number is used to store it to a column on *nix environment, then from_number is used on that stored number in Windows environment. Though I am not sure why someone would do this.
Also, does the number work in negative, e.g. someone on a *nix system using to_number on a date earlier than 1970? Last edited by ownedbycats; 03-26-2021 at 06:16 PM. |
![]() |
![]() |
![]() |
#25 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,156
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
|
I think python implementation for this sticks with POSIX timestamp regardless of operating system (might be wrong on this). I don't have Windows to test on. But you can test the ouput of this template:
Code:
program: format_date('1900-01-01T00:00:00+00:00', 'to_number') |
![]() |
![]() |
![]() |
#26 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,063
Karma: 69102175
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I got the same result on a Windows environment. That's good that it stays the same.
![]() |
![]() |
![]() |
![]() |
#27 | |||||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Quote:
Quote:
Quote:
My take: these numbers are good for comparing dates and doing arithmetic on dates, but not much else. |
|||||
![]() |
![]() |
![]() |
#28 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,063
Karma: 69102175
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Also I was experimenting and came across something strange
The highest date available in the Calibre date fields seems to be 9999-12-31 so I put this in: Code:
program: format_date('9999-12-31T23:59:59+00:00', 'to_number') So I put that back in this: Code:
program: format_date('253402300799.0', 'from_number') Last edited by ownedbycats; 03-26-2021 at 08:09 PM. |
![]() |
![]() |
![]() |
#29 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,244
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
![]() Quote:
For example, on windows this expression works: Code:
format_date(1031*(365*24*60*60), 'from_number') The 2032 year-in-the-future expression Code:
format_date(1032*(365*24*60*60), 'from_number') For more bad news see Year 2038 problem. Bottom line: you can't trust timestamps. |
|
![]() |
![]() |
![]() |
#30 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,063
Karma: 69102175
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Deep Impact was lost because the date was stored as an unsigned 32-bit integer that overflowed.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
A few questions... (template language, mainly) | Clem2605 | Library Management | 2 | 12-30-2020 04:25 AM |
Template Language | phossler | Calibre | 8 | 01-12-2016 05:37 PM |
Help needed with template language | Mamaijee | Devices | 12 | 02-19-2013 02:52 AM |
Help with template language | Pepin33 | Calibre | 8 | 11-11-2012 09:32 AM |
Template language question | BookJunkieLI | Library Management | 7 | 02-02-2012 07:55 PM |