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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to