Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
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
Old 05-25-2012, 12:25 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by hd_cal_dave View Post
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.
as long as you do an ASCII sort with Leading Zero's one or the other will sort

The issue with BC is it an Ascending value the more it gets away from the Year 1.
The problem is the BC value sorts next to AD
0234AD
0234BC
1000AD
1000BC


You really need to use Signed numbers (forget about the AD/BC)

Maybe a Export template could made to drop the - Sign and ad the BC suffix
theducks is offline   Reply With Quote
Advert
Old 05-28-2012, 02:01 AM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Have a look at https://www.mobileread.com/forums/sho...d.php?t=171823. It discusses something similar with a few suggestions of how to do it.
davidfor is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifying date of publication: can I display the year only? BMaloney Library Management 3 02-23-2011 04:09 AM
[KOBO] Strip existing formatting to apply my own default formatting to all books digital_steve Calibre 2 08-10-2010 06:34 PM
Calibre and FORMATTING how to stop it altering my formatting? nerys Calibre 0 02-28-2010 04:51 PM


All times are GMT -4. The time now is 04:12 PM.


MobileRead.com is a privately owned, operated and funded community.