[OPEN-ILS-GENERAL] To Displaying date format in the Receipt Template Output (Michele Morgan)

Thomas Berezansky tsbere at mvlc.org
Wed May 14 09:08:22 EDT 2014


The DATE_FORMAT macro only works when you hand it a non-formatted  
date. Shelf expire time is an example (and is the reason DATE_FORMAT  
exists, I couldn't get agreement on the output for shelf expire time  
so I didn't format it and provided the format macro instead).

Most dates provided to the receipt templates get formatted ahead of  
time and thus can't be re-formatted with it. :(

As an alternate, use substring manipulation:

%SUBSTR(-9,-100)%%due_date%%SUBSTR_END%

With negative numbers in the start and length positions that says:
Start 9 characters from the end of the string, then show 100  
characters before that. " 11:59 PM" is 9 characters, and thus doesn't  
get shown.

Length is optional and if not specified will be "from where you said  
to start to the end of the string" - Thus if omitted from the above  
would give you just the " 11:59 PM" piece.

Also useful for:
"last 4 digits of barcode" %SUBSTR(-4)%...
"last 4 non-checksum digits of barcode": %SUBSTR(-5,4)%...
"first 10 characters of last name" %SUBSTR(0,10)%...
etc


Quoting Jayaraj JR <jayaraj at iisertvm.ac.in>:

> Michele Morgan,
>
> I have made change in the receipt template as suggested by you.
>
> %DATE_FORMAT(%due_date%, %d/%m/%Y)%
>
> In the preview of the template it gives the date only as output while in
> the printed receipt both date and time is not displayed.
>
> When %due_date% alone is given, in the preview only the date format is
> displayed. While printing the receipt both date and time prints. In the
> checkout window of the patron due date column gives both and time.
>
> Is there any other way available to print due date only in the date format.
>
>
> --
> Jayaraj J R
> Library Information Assistant
> Central Library
> IISER Thiruvananthapuram


Thomas Berezansky
Merrimack Valley Library Consortium


More information about the Open-ils-general mailing list