Another question multiple times means another blog! 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 scenario, 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 🙂
Step 2 – Remove Time
No, I am not a wizard, I can’t 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 can change the date format. Here we want to select “Short Date” in order to get MM/DD/YYYY
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.