[NTG-context] mail merge in mkiv?

Pablo Rodriguez oinos at gmx.es
Mon Nov 10 17:46:00 CET 2014


On 11/10/2014 12:17 AM, Jaroslav Hajtmar wrote:
> Hello Pablo.
> Here is example of add days in Lua:
> 
> \startluacode
> x=5 -- add five days
> tex.print ('Actual date is :'..os.date('%d.%m.%Y')..'\\crlf')
> tex.print ( 'And x days added date is :'.. os.date('%d.%m.%Y',os.time()+ 
> x * 24 * 3600))
> \stopluacode

Many thanks for the reply, Jaroslav.

I wanted to avoid Saturdays and Sundays, so I wrote:

\startluacode
x = 1
final_date = os.date('%a',os.time()+ x * 24 * 3600)
if final_date == "Sat" then
  x = x + 2
elseif final_date == "Sun" then
  x = x + 1
end
tex.print ( os.date('%d/%m/%Y',os.time()+ x * 24 * 3600))
\stopluacode

This is all Greek to me, but it seems to work.

Many thanks for your help again,


Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list