• Skip to main content
  • Skip to primary sidebar

Technical Notes Of
Ehi Kioya

Technical Notes Of Ehi Kioya

  • Blog
  • Shop
  • Forums
  • Subscribe
  • About
  • Contact
MENUMENU
  • Blog Home
  • AWS, Azure, Cloud
  • Backend (Server-Side)
  • Frontend (Client-Side)
  • SharePoint
  • Tools & Resources
    • CM/IN Ruler
    • URL Decoder
    • Text Hasher
  • Linux & Servers
  • Zero Code Tech
  • WordPress
  • Musings
  • More
    Categories
    • Cloud
    • Server-Side
    • Front-End
    • SharePoint
    • Tools
    • Linux
    • Zero Code
    • WordPress
    • Musings
Home » SharePoint » How To Set A Date Value In A SharePoint Designer Workflow

How To Set A Date Value In A SharePoint Designer Workflow

By Ehi Kioya 3 Comments

This article explains different methods of setting a date value (date variable) using a SharePoint designer workflow. It describes how a date variable can be set to either a static date, a dynamic date, or a calculated date.

Assumptions

  1. You already have a workflow in which you want to set (or calculate) a date
  2. You have created a variable named DateVar of type Date/Time in your workflow

A date variable in a SharePoint designer workflow can be set to a specific (or static) date, or it can be set to a calculated (or dynamic) date [for example, today’s date plus 5 days].

Let’s start by showing how to set a date variable either to today’s date or to some specific date.

1. Set A Date Value To Today’s Date Or Some Specified Date

To set the value of our DateVar variable to the current date or some other specific date:

  • Add the Set Workflow Variable action to your workflow
  • Set the workflow variable parameter to the DateVar variable you previously created
  • Click value in the Set Workflow Variable action and then click the ellipsis button
    Set Date Value To Current Date SharePoint
  • Select either Current date or Specific date (if you’re setting a specific date, choose the date and/or time from the options)
  • Press OK

2. Set A Date Value To The Value Of A Date Column In A List

To set the value of our DateVar workflow variable to the value of a date field in a list (say the Created date field):

  • Add the Set Workflow Variable action to your workflow
  • Set the workflow variable parameter to the DateVar variable you previously created
  • Click value in the Set Workflow Variable action and then click the formula (fx) button
    Set Date Value To Field Value SharePoint
  • On the Field from source dropdown, select the Created date field (assuming that’s the date field you want to use)
  • Press OK

3. Set A Date Value To The Value Of A Calculation

To set the value of our DateVar workflow variable to the value of a date calculation, for example, to a date that is 5 days from today:

  • Create a new variable named TodaysDate of type Date/Time in your workflow
  • Add the Set Workflow Variable action to your workflow
  • Set the workflow variable parameter to the TodaysDate variable
  • Click value in the Set Workflow Variable action and then click the ellipsis button
    Set Date Value To Current Date
  • Select Current date and press OK
  • Add the workflow action called Add Time To Date to your workflow
    Add Time To Date Workflow Action
  • Notice that a new Date/Time variable named date has been automatically created for you and used to store the output of the above action. Delete the automatically added variable (to keep things clean) and set the output to the DateVar variable you created earlier
  • Click 0 in the text for the action and type 5. Click minutes and select days from the dropdown.
  • Click date, click the formula (fx) button
  • For the Data source parameter, select Workflow Variables and Parameters
  • For the Field from source parameter, select Variable: TodaysDate
    Add Time To Date SharePoint Workflow
  • Press OK. The workflow lines will look like this:
    SharePoint Date Actions
    NOTE: Trying to combine both lines into one, as shown below won’t work. At least, it didn’t work for me.
    Incorrect Add Time To Date SharePoint Workflow

Bonus Tip: How To Blank Out A Date Column

You may sometimes need to set the value of a date column to empty or blank or null. You will NOT be able to do this by just plugging in an empty value or a space.

Interestingly, SharePoint requires that you set the date to 1/01/0001 and that you use a variable to do this instead of attempting a direct value assignment.

Why these requirements? I don’t know. That’s just how it is. I discovered it the hard way too 🙁

So here’s how you would go about blanking out a date field:

  • Create a workflow variable named EmptyDate
  • Using the Set Workflow Variable action (described earlier), set the variable value to 1/01/0001
  • Set the date field you want to blank out to the workflow variable EmptyDate

Found this article valuable? Want to show your appreciation? Here are some options:

  1. Spread the word! Use these buttons to share this link on your favorite social media sites.
  2. Help me share this on . . .

    • Facebook
    • Twitter
    • LinkedIn
    • Reddit
    • Tumblr
    • Pinterest
    • Pocket
    • Telegram
    • WhatsApp
    • Skype
  3. Sign up to join my audience and receive email notifications when I publish new content.
  4. Contribute by adding a comment using the comments section below.
  5. Follow me on Twitter, LinkedIn, and Facebook.

Other Articles You May Like:

Filed Under: SharePoint Tagged With: Designer, SharePoint, Workflow

About Ehi Kioya

I am a Toronto-based Solutions Architect and Lead Software Developer of an outsourced team.

I run this technology blog, as well as this consumer products shop.

You can read more about me here, and connect with me via Twitter, LinkedIn, and Facebook.

If you want to collaborate or talk to me privately, send me an email using this form. But please note that I don't answer questions or provide support via email.

To share your thoughts or get help with any of my posts, drop a comment at the appropriate link.

Reader Interactions

Comments

  1. Mark David Hortman says

    June 13, 2017 at 10:10 am

    How do I assign a date variable back to a PWA date variable. Nothing seems to work?

    Reply
  2. Courtney says

    November 2, 2018 at 12:38 pm

    This is a great guide on how to do this. Thanks!

    Reply
    • Ehi Kioya says

      November 2, 2018 at 12:51 pm

      Glad I could help.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

426,009
Followers
Follow
30,000
Connections
Connect
15,217
Page Fans
Like

FROM   THE   SHOP

  • Typewriter Inspired Retro Keyboard

    Typewriter Inspired Retro Keyboard
    Rate this product:

    Take your writing game several notches higher with the Typewriter Inspired Retro Keyboard. With this charming keyboard on your table, you’re going to look like a secretary from the 1800s that somehow got transported into the future.

    $269.99 (as of Dec 5, 2019 - 4:39 pm) Check it out
  • Recently   Popular   Posts   &   Pages
  • Allowing Multiple RDP Sessions In Windows 10 Using The RDP Wrapper Library Allowing Multiple RDP Sessions In Windows 10 Using The RDP Wrapper Library
    This article explains how to bypass the single user remote desktop connection restriction on Windows 10 by using the RDP wrapper library.
  • Actual Size Online Ruler Actual Size Online Ruler
    I created this page to measure your screen resolution and produce an online ruler of actual size. It's powered with JavaScript and HTML5.
  • Get XML Document Nodes Recursively with C# Get XML Document Nodes Recursively with C#
    Here are two methods to get XML document nodes, child nodes and so on. The first method uses DOM. The second method uses LINQ to XML.
  • WordPress Password Hash Generator WordPress Password Hash Generator
    With this WordPress Password Hash Generator, you can convert a password to its hash, and then set a new password directly in the database.
  • How To Shrink Amazon EBS Volumes (Root Or Non-Root) How To Shrink Amazon EBS Volumes (Root Or Non-Root)
    In this article, I describe a technique to shrink Amazon EBS volumes. This is very useful if you ever mistakenly over-allocate your EBS.

FROM   BLOG   READERS…

  • Jeff Kee on How To Shrink Amazon EBS Volumes (Root Or Non-Root)One of my mistakes, I realize, was I actually mounted the partitions using sudo mount /dev/[deviceid] [mountdir], whereas I think I'm not supposed to…
  • Geoffrey Mureithi on 5 Old Web Development Trends That You Should Remove from Your SiteFlash is still a little bit relevant esp in playing videos, but then I would not sit in an actionscript class
  • Howard Bash on Setting up a SharePoint 2016 dev farm in Azure – Part 4: SharePoint 2016 InstallationYes. I appreciate your help on this. Thanks! I'll double check. I connected to the sqlVM using SP. I'll try the other two now.
  • Alan Bombria on Forcefully Clear Jobs from the Print Queue or SpoolerMy batch file: net stop spooler del /F /Q %systemroot%System32spoolPRINTERS* net start spooler
  • nynymike on How OAuth Can Make Your Web App Safer and More UsefulIf your goal is authentication, use the OpenID Connect profile of OAuth2 http://openid.net/connect If you make up your own profile, you'll probably sc…
  • Liviu Balan on Moving A VirtualBox VM With SnapshotsIf you want to learn more about Snapshot and Clone in VirtualBox you can checkout VirtualBox Snapshot and Clone video tutorial.
  • Thomas Lange on How To Shrink Amazon EBS Volumes (Root Or Non-Root)Thx for the instructions. Worked (almost) flawless. Although I had some strange behavior when attaching devices and then powering on the machine. AWS…
  • Blog
  • Shop
  • Forums
  • Subscribe
  • About
  • Contact

© 2019   ·   Ehi Kioya   ·   All Rights Reserved
Privacy Policy