This topic contains 3 replies, has 2 voices, and was last updated by steve.ela@macrohelix.com 4 years, 1 month ago.
Increment by # days
You must be logged in to reply to this topic.
This topic contains 3 replies, has 2 voices, and was last updated by steve.ela@macrohelix.com 4 years, 1 month ago.
Hi all. I am trying to convert a lot of my code snippets from the old system to Iguana.
One was use to pass a date and an integer, and return a date that was incremented by that many days.
I was trying with os.date and os.time, but I cannot simply increment the ‘day’ field in the lua data table returned.
Any directions would be appreciated.
Steve Ela
Macro Helix / McKesson
Software Developer / Integration Lead / Scrum Master
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
Thanks. Saw some examples like that. Thought there would be an easier way, but guess not 🙂
Steve Ela
Macro Helix / McKesson
Software Developer / Integration Lead / Scrum Master
With some slight modification, got it working perfectly
Steve Ela
Macro Helix / McKesson
Software Developer / Integration Lead / Scrum Master
You must be logged in to reply to this topic.