Removing Time from DateTime variables

  • 21 September 2023
  • 2 replies

Badge +1

I have a pretty straightforward form that is inserting DateTime variables from a SharePoint list but whenever they print to email, the data always includes the time as well as the date - which is not something that was included, so it always shows up as “12:00:00 AM”. Ideally, I’d like to format that out - but so far I havent found a way to do that. 

For example my Input would be:

and the output is:


SharePoint settings are as follows:




Best answer by bamaeric 21 September 2023, 22:21

View original

2 replies

Userlevel 6
Badge +16

Hi @Iramos85 

You can select the return type for the Datetime as either Long Date or Short Date to omit out the time.


Userlevel 5
Badge +12

Another option is to use a Regular Expression action to remove everything after the date.

Here is how to do that:

  1. Add a Regular Expression action to the workflow.
  2. Configure this action with these settings:
     - String = Date of Request
     - String operation = Replace
     - Pattern = \s[0-9]+:[0-9]+:[0-9]+.{3}$
     - Replacement string = Leave empty
     - Output = txtDateOnly  (this is a text workflow variable that you create)
  3. This returns only the date with the time, AM/PM, and spaces removed.
  4. You can then use this text workflow variable in your email.