View Single Post
Old 05-25-2012, 11:00 AM   #1
hd_cal_dave
Enthusiast
hd_cal_dave has a complete set of Star Wars action figures.hd_cal_dave has a complete set of Star Wars action figures.hd_cal_dave has a complete set of Star Wars action figures.hd_cal_dave has a complete set of Star Wars action figures.
 
Posts: 25
Karma: 366
Join Date: May 2012
Device: Android
Formatting publication year for BC vs AD

As I understand it, the Calibre pubdate field (or any date based field) cannot handle books created BC. I have a number of ancient texts and would like to track this year.

So I have added a "First Published Year" field to my library and will have it hold a simple integer where negative numbers mean B.C. This is working well, but I see that each custom column has a "formatter" associated with it for pretty printing the value.

Doesn't anyone know the Python I'd have to create to turn my year number into something nice (for example):

-999 -> "1000 BC"

234 -> "234 AD"

I'd like to still sort on the internal integer value however.
hd_cal_dave is offline   Reply With Quote