View Single Post
Old 03-25-2021, 03:42 PM   #434
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,204
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
I tried it using an action that stores the book_id to a column. It worked very nicely. I will try the book_vars variant later.
Good to know.

Quote:
Originally Posted by chaley View Post
Comparing date strings:
Code:
if format_date($last_modified, 'iso') > format_date($#mydate, 'iso') then
Never thought about comparing iso strings. Nice trick.

Quote:
Originally Posted by chaley View Post
However, I think a good solution is to add the 'timestamp' format to format_date, returning a floating point timestamp. I would also change format_date() to allow a timestamp as the first argument (the "date") permitting conversion of timestamps to date strings. This would do what you need and also facilitate arithmetic on dates. Example:
Code:
program:
	t = format_date($last_modified, 'timestamp');
	strcat(t, ' -- ', format_date(t, 'yyyy MMM ddd hh:MM:ss'))

Result: 1616695611.0 -- 2021 Mar Thu 18:03:51
One possible problem with both implementations: the dates lose their timezone. I don't see that as a big deal.
Sounds like a perfect solution. The timezone thing is not important IMO. I will remove the to_timestamp() from the next version as yours is much better.
capink is offline   Reply With Quote