9

Is there a way to set or create a date/time workflow variable with the current date and current time in a 2013 SPD Workflow?

10 Answers 10

5

I've found that in Sharepoint Designer 2013 there's an option to select today. If you click the ellipses next to the value option, there's a selector for current date.

enter image description here

enter image description here

  • This sets the time to midnight of the current day, unfortunately. It's the difference between =TODAY and =NOW. – Chris Romp Jan 5 '18 at 17:36
4

You would simply use the set workflow variable action and use the current date or use the add time to date action and set 0 days/hours/minutes/seconds to Today.

  • 4
    Could you please elaborate? I'm facing the same problem and I can't find any way to get the current date and time from server. The "Today" will give date, not time. I'm currently trying to do something like this: sharepoint.stackexchange.com/a/130179/627 , but in Designer workflow I get that Date can't be read as string (or converted to DateTime). – eirikb Oct 9 '15 at 6:29
  • I'm also working against Online, so I can't see the data being passed. And I don't know how to "dump" response headers to history list. I can however tell you I got a count of 18 headers – eirikb Oct 9 '15 at 6:50
1

Made a super-ugly hack (solution?).

Context: I need to get the current Date and time in a 2013 Designer Workflow, and I need it in a loop.

What I've come up with so far: Write something unique to the history list, find that history list item and get item created date.

Example

enter image description here enter image description here

Update

If you don't mind updating the item it is possible to use the same hack to get Modified of Current Item

enter image description here

I hope I'm doing something wrong, this can't be the correct solution...

1

Make a SharePoint 2010 Site Workflow (in SharePoint Designer 2013). Add these actions (or just the first one) and publish the worflow.

Start this from within a SharePoint Designer 2013 workflow to get Current Date and Time.

enter image description here

  • 2
    I don't see 'Date and Time Started' under my Workflow Context. Any ideas why not? – Even Mien Dec 2 '15 at 12:01
1

Another easy way is to create in your table a calculated column (type date/time) and use the formula =NOW(). Every time the item is triggered by a workflow, this column is updated. And then, you can simply use the content of this field in your workflow.

1

I've used the "Current Item:Modified" column to get the date as well as the time part to get the also current time.

Modified column is useful within workflow only after any of the column is updated, for example by "Set Field in Current Item" action. Looks like these actions are committed before next action.

So the actions will look like:

Set AnyFieldToUpdateModifiedColumn to AnyValueYouWish
Set MyDateAndTimeColumn to Current Item:Modified
  • What I am not sure is whether or not the result of the first Set action is guaranteed to be consistent for the second action. If the SharePoint workflow action sequence adapts "eventually consistent" strategy, this approach may fail time to time.. – satoc Sep 5 '17 at 9:56
0

I used another list named "Properties", created an item with a unique key and "Modified" time of this item will have the current date and time.

How it works...

This list has 2 columns, one is Title(which is unique and my lookup key) and another is "value" (choice , Y or N), the column can be in any name.

Whenever your workflow starts, it look up this item from this list and check for "value" column. If the "value" column is Y, it will set to N and vise versa. then it will lookup the modified time of this item. This will have the current date and time.

P.S. the date and time is based on where your SharePoint Online is hosted, usually it will return the current US date and time

0

The best approach is to use a Modified date with two Update Item actions. First to update the list with some dummy data or update the same column, now you will have the latest Modified date with time, which you can use current date time.

-1

I use the Call HTTP-Webservice action to get the current time and date. I send a request to a random web-service and parse the metadata of the respond head. The output is stored in a variable of the type Date and Time.

If you like to read step by step, visit my blog entry:

-1

Can you just lookup "Workflow Context" > "Date and Time Last Run"?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.