Here’s an example you may find useful:

   local atime = os.ts.time({year=2019,month=1,day=1,hour=0,min=0,sec=0}) -- create epoch time
   local aweek = (60 * 60 * 24 * 7) -- # of seconds in a week
   local btime = atime + aweek -- add a week
   local adate = os.ts.date("%Y%m%d%H%M%S",btime) -- format epoch time to HL7 standard date/time

Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com