Get current time in Sharepoint Designer workflow
Get the current time in a standard SharePoint Designer workflow and assign to a workflow variable
I was having trouble getting the current time in a SharePoint Designer workflow when testing against a date/time field of the current item. I noticed that when testing if the date was greater than [today] which is the only option to test against the current date, the time was ignored as [today] returned 12:00 AM as the time.
To be a little more specific, I needed separate actions performed on the current item if the item's creation date/time + 4hrs was greater or less than the current time. In other words, the condition test was if it was created less than or greater than 4 hours ago.
Being unable to select a [now] option to test against the current time, I was getting unexpected results.
My solution (a little clunky, but works) to get the current time was to modify/update a temporary list item (update any field with any value), wait a minute and then store the modification date in a workflow variable. I found that updating an item and getting the modification date was more efficient than creating a new item and getting the creation date.
I also found that if there is not a pause after creating/modifying the temporary list item an error often occured in the workflow when trying to get the modification date of the recently updated list item, as the modification had not yet registered correctly in the list. Setting a pause for the minimum (1 minute) ensures that when the date is retreived, the list item is ready.
By Daniel S Popularity (6686 Views)