Home > Blockchain >  Apache FreeMarket - add days to dates
Apache FreeMarket - add days to dates

Time:01-13

I am trying to add 1 day to the current date. I do know ${.now?date} = The Current Date. But how do I add a day to that? I read that you have to use milliseconds (86,400,000 milliseconds) but I'm unsure what the operation should be.

Thanks in advance for the help!

CodePudding user response:

Figured it out!

${(.now?long   86400000)?number_to_date }

CodePudding user response:

The detailed answer is here:

<#assign currentDate = .now>
Current Date : ${currentDate?date}<br>
<#assign numberOfDays = 1?long>
<#assign timeInMillisecond = (1000 * 60 * 60 * 24 * numberOfDays) >
<#assign aDate = currentDate?long   timeInMillisecond?long>
<#assign Diff = aDate?long>
<#assign OneDayAfterDate = Diff?number_to_date>
<br>Date after ${numberOfDays} Days : ${OneDayAfterDate}<br>
<br>Date after ${numberOfDays} Days in UTC format : ${OneDayAfterDate?iso_utc}<br>
  •  Tags:  
  • Related