SharePoint 2010: Get TimeStamp in SPD 2010 Workflow

Requirement

I would like to send an email at specific time from SharePoint Designer workflow. For this purpose I could use the Action in SPD to select the current date, add number of days to it and pause until that date to send the email. If you notice, SPD workflow calculates the date part correctly but the timestamp is always 12:00:00 AM. I need to get exact time as well.

How to do this

When the item is created in the SharePoint list, the Created column contains the Date/Time details. Extract the time part of this date by using Action "Extract Substring from End of String". The last 11 characters of Created date shows the timestamp. Save this in a variable that is of String data type.

Copy 11 characters from end of Current Item: Created (Output to Variable:TimeStamp) Ex: 10:38:29 AM. Now you can use Action to Add Time to Date.

Add 2 minutes to Variable: TimeStamp (Output to Variable: FirstDate) Ex: 8/13/2013 10:40:29 AM

Configuration of Variable: TimeStamp -

  • DataSource: Workflow Variables and Parameters
  • Field from Source: Variable: TimeStamp
  • Return Field as: As Date/Time

Surprisingly it works fine with String and saves the result in variable that is date/time data type (FirstDate).
Add action to Log to History list and add reference to your workflow variable. Check if the time stamp is updated and shows correctly.

Log Variable: FirstDate to the workflow history list
Note: Unable to upload images at this point to support the article.