View Single Post
Old 03-16-2025, 07:30 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Ah, that makes sense. For future, is there a way to edit the time part of date column directly, aside from maybe changing the column format?
Not that I can think of. Perhaps an SFE in action chains along with some dialog to capture the date.

Here is a template that changes the date (timestamp) to whatever you put in line 9. Be sure to get an example so the timezone is correct.
Code:
python:
def evaluate(book, context):
	db = context.db.new_api
	# Get the current timestamp.
	v = db.field_for('timestamp', book.id)
	print(1, v)

	# The corrected timespamp goes here
	db.set_field('timestamp', {book.id: '2023-06-23 09:36:34+00:00'})

	# See if the timestamp changed.
	v = db.field_for('timestamp', book.id)
	print(2, v)

	# return the new timestamp
	return str(v)
chaley is offline   Reply With Quote