Retrieve Current Date Time in UTC using Nintex Workflow

It seems every time I work with dates it usually ends up being a bit of pain. Lately a lot of my work has been done in JavaScript and libraries like Moment.js have definitely helped to make life easier.

I recently encountered an issue where I was creating an approval history feed against a SharePoint list item. This data was created as JSON and would be read in using JavaScript, formatted and then output to a page. Users would be accessing this from different time zones so it was important that the date was accurately displayed for all users.

Using Nintex Workflow I decided to update this approval history field throughout various stages of the workflow. I initially had some issues with accurately setting the time against each entry due to some unexpected Nintex behavior. I found that when I set a variable to the Current Date/Time the time component would be based on the servers timezone. Saving the date as a string would give me the date and time but no timezone was specified, which I assume is a bug. To get around this I was able to add an additional step and then get the time based on UTC.


In my test workflow I created a few variables; Current Date, Current Date ISO 8601 and Current Date ISO UTC.

To set the dates I used the Calculate Date action as shown below:

Running the workflow and outputting the variable values to the workflow history displayed the following:

Current Date: 11/14/2015 11:59 AM
Current Date ISO 8601: 2015-11-14T11:59:03Z

The time component here is based on the local time and no offset for UTC is specified. Before you mention it, changing the Time is field to UTC did not make any difference, I believe this is telling Nintex the format of the date/time that you are feeding into the Calculate Date action.

To get around this issue I found that adding a Set Variable action and setting the return type of the date to ‘ISO Formatted’ actually provided me a date with time based on UTC.


Now when I look at the workflow history I see that Current Date ISO UTC is now accurately reflecting the time.

Current Date: 11/14/2015 11:59 AM
Current Date ISO 8601: 2015-11-14T11:59:03Z
Current Date ISO UTC: 2015-11-14T01:29:03Z

This is obviously my work around to this issue, if you have any further insight or a better way of doing this please let me know in the comments.

Leave a Reply

Next ArticleFiltering users with the pickSPUser widget in SharePoint Forms