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 01-13-2014, 11:55 AM   #1
tarisea
Zealot
tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.
 
Posts: 114
Karma: 6288
Join Date: Dec 2012
Device: iphone
Custom Column Date Question

I have a custom column (releasedate) with a date in it. The date is formatted dd mmm yy (13 Jan 13) and I want to leave this column alone.

I need another column that will look at this column and give me mmyy (0113). I have tried several ways but I keep getting the strangest results.

Can someone give me a hand.

Thanks you.
tarisea is offline   Reply With Quote
Old 01-13-2014, 12:22 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,032
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The template to use in the "column built from other columns" is
Code:
{#mydate:format_date(MMyy)}
with #mydate replaced with the lookup name of your column (#releasedate?).

Explanation: mm is minutes, 2 digits with a leading zero. MM is the month, again 2 digits with a leading zero.
chaley is offline   Reply With Quote
Advert
Old 01-13-2014, 12:24 PM   #3
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,451
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
http://manual.calibre-ebook.com/template_lang.html
in the section
Code:
format_date(x, date_format) – format_date(val, format_string) – format the value, which must be a date field, using the format_string, returning a string. The formatting codes are:
Old school DB guy here:

Why bloat the DB with 2 columns of the essentially the same data with a display variant?
If you need MMYY on an export, do it (the format conversion) in the save template
If you want the GUI to SHOW MMYY
Preferences: Add your own column: (select your column name):click the blue i and change the Format for dates (this is a Display format, not the data format, which is still a full date)
theducks is offline   Reply With Quote
Old 01-13-2014, 05:07 PM   #4
tarisea
Zealot
tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.tarisea got an A in P-Chem.
 
Posts: 114
Karma: 6288
Join Date: Dec 2012
Device: iphone
Chaley that's perfect.

Just purely out of curiosity is it possible to take this one step further?

#column1 - numeric value
#column2 - fixed set of values, but only 1 is relevant here
#column3 - date

Is it possible to:

If #column1 >1 AND #column2=blue then {#column3:format_date(MMyy)} otherwise blank

Just pushing my luck. Tired of doing things manually.

Thanks
tarisea is offline   Reply With Quote
Old 01-13-2014, 06:01 PM   #5
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,032
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by tarisea View Post
Chaley that's perfect.

Just purely out of curiosity is it possible to take this one step further?

#column1 - numeric value
#column2 - fixed set of values, but only 1 is relevant here
#column3 - date

Is it possible to:

If #column1 >1 AND #column2=blue then {#column3:format_date(MMyy)} otherwise blank

Just pushing my luck. Tired of doing things manually.

Thanks
Code:
program: cmp(
	field('#column1'), 
	1, 
	'', 
	'', 
	strcmp(
		field('#column2'), 
		'blue', 
		'',
		format_date(field('#column3'), 'MMyy'), 
		''
		))
chaley is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date custom column built from a Y/N one? glos Library Management 3 08-25-2013 01:48 PM
Bulk Clear Custom Column Date - Not Working BetterRed Calibre 5 02-23-2013 06:04 AM
custom date column from two state column Dopedangel Library Management 7 01-03-2012 09:20 AM
Question about the default 'Date' column jukin Calibre 5 08-31-2011 09:15 PM
Custom column for date added Gunnerp245 Calibre 2 07-08-2011 05:39 PM


All times are GMT -4. The time now is 01:12 AM.


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