View Single Post
Old 11-18-2011, 03:16 PM   #2
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,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Assuming you are writing a custom template function, the following gets the first three digits of the year with a trailing 0. It doesn't check for the 'undefined' date (1/1/0101).
Code:
def evaluate(self, formatter, kwargs, mi, locals):
	x = (mi.pubdate.year/10)*10
	return '%04d'%x
chaley is offline   Reply With Quote