Skip to main content
Nintex Community Menu Bar

Hi guys,

I have an issue converting an integer to date in nintex forms.

Scenario:

I have a main list and a task list. Task Items are connected to the main item using Lookup Fields.

Using this formula I am able to get the latest DueDate of the task list for a specific main item:

max(lookup("Tasks","LookupField:ID",{ItemProperty:ID},"DueDate",true))

This however converts the Date field to the integer representation of this field (e.g. "1624485600000").

I found the "convertToDate" and "formatDate" functions but unfortunately they tell me my value is not a number:

18623iD866E7CA8E603131.png

 

Normally you could convert this back to a Date for example using Javascript

var x = new Date(1624485600000)x.toDateString() //expected: "Thu Jun 24 2021"

 But using this, the form tells me this:

18624i691B5D9A59108B22.png

 

Last part translated: "The object does not support this action". This only occurs when I add the "new Date()" part to a calculated value in the form.

Is there any other way to convert this value back to a date?

 

I am using Forms for SharePoint 2013

Thanks!

So after some thought I figured it out:



The integer 0 correlates to 01.01.1970. Given that the integer basically just means "miliseconds elapsed since 01.01.1970", we can calculate the date back using a formula such as



formatDate(dateAddMinutes(convertToDate("01.01.1970"),maxActionDate / 60000),"dd.MM.yyyy")

Using convertToDate we get the "base" date.
As Nintex´ lowest dateAdd* function is dateAddMinutes, we calculate miliseconds to minutes (divided by 60000) and add the result as minutes.
Afterwards we can convert it as it is now a date. 



Somehow using this my date is not perfectly accurate as it shows a day off but I can just add the extra day later using dateAddDays.


Reply