cancel
Showing results for 
Search instead for 
Did you mean: 

How To: Get Date Without Time in Nintex Workflow for Office 365

Nintex Employee
Nintex Employee
4 3 1,224

I get this question a lot and there seems to be no clear directions on how to accomplish this, so I decided to put it down on (digital) paper so we can all benefit!

 

If you have worked with SharePoint ever, and tried to do something with dates, you understand that pain that comes along with a date column... the time stamp. I am not going to go into details on why SharePoint insists that everything has a time, but simply focus on how to remove the time piece within a workflow.

 

For this sceanrio, I took a super simple approach. I am getting the current date (Add Time to Date) and then formatting a string to only contain the date (Build String). Keep in mind that if you already have a date variable, you can use that variable and skip the first step. So let's go!

 

Step 1 - Get Today

Here we simply use the Add Time to Date action to get the current date and time (when the action is executed) and that's it. I told you it was simple Smiley HappyGet Today.PNGGet Today

 

Step 2 - Remove Time

No, I am not a wizard, I can't actually remove the passage of time...but I can remove the time stamp from the variable using a Build String action! In your action, click on Advanced Lookup, the Workflow Variables (in the dropdown) and then select your variable you need. At this point, if you already had a variable in place, you can use it, just select it via the Advanced Lookup and not the Insert Reference to the right. 

The reason we do it this way is so we can specify how we return the data out of the variable. Click on the "X" to the right of the variable dropdown and you are able to change the date format. Here we want to select "Short Date" in order to get MM/DD/YYYYShortDate.PNGReturn Short Date

 

So now we have our current date without the time stamp that SharePoint insists giving us! This is great for doing date comparisons or adding date values into a document generation action.

 

Hope this has been helpful!

Let me know how you solved this issue if you ran into something similar.

3 Comments
klaw
Nintex Newbie

Thanks for this tip! I did this but my "Run If" command to test if the two dates match does not run despite the two strings matching. Any ideas? This is driving me crazy! Below is a screenshot of my workflow's log:nw.png

 

Nintex Employee
Nintex Employee

@klaw 

Assuming you followed along with the post to get the one date. How is the other formatted? Also, are you comparing dates or strings? In my post we converted the date variable into a string variable.

 

Let me know, I'd be happy to take a look.

 

klaw
Nintex Newbie

Thank you for getting back to me and offering to take a look. I did eventually get it working. i was comparing string to string, short format to short format. i'm sure everything was set up correctly, and it still wasn't triggering the run if to return true. i eventually deleted the run if action and inserted it again using the exact same string variables and then it worked. Smiley Frustrated