Formatting DateTime fields to remove time

  • 15 June 2016
  • 7 replies
  • 305 views

Badge +9

Hi

 

During testing,  muy Users have noticed the following formats for  Date Time fields in the body of the Assign Task email

 

 

START DATE    15/06/2016 00:00:00

END DATE    16/06/2016 00:00:00

 

Is there a quick way to change this  other than editing the generated HTML

 

<td style="color:#444444;font-family:Segoe UI Light,sans-serif;font-size:11pt;vertical-align:top;">‎‏<span contenteditable="false" data-nintextoken="true" style="display:inline-block;"><a class="ms-rtestate-write draggableToken" contenteditable="false" href="href="#"" link="false" onclick="return false;" reftext="nw-stringbuilder-token-1e1b82db-b7df-4186-a943-a0fa0f2fe66e" spellcheck="false" style="color:red;text-decoration:none;cursor:pointer !important;"><span data-nintextoken="true">{Current Item:Start Date}</span></a></span>‌</td>

 

oh and before somebody asks, this the current column settings!

 

Start Date Collumn settings.PNG

 

Daniel


7 replies

Userlevel 5
Badge +13

Hi Daniel,

Try using a Regular Expression with the following settings:

  • String = Start Date field
  • String operation = Replace
  • Pattern = [0-9]+:[0-9]+:[0-9]+ [a-zA-Z]+
  • Replacement string = empty
  • Output = Text variable

Then use the text variable in your task email.

Badge +11

I would recommend creating text Workflow Variables "Start" and "End", and then setting these variables just before the task in your workflow using Set Workflow Variable and setting Start to the date format you wish by pressing on the orange fx button to pull-up the return type selection box:

SelectDateFormat.PNG

You can then replace Start Date with the Workflow Variable "Start" in your email layout.

Badge +9

Shaun  /  Eric

I will look at your suggestions when I get in tomorrow. I think one of the team has made a change by setting string variables from both the Start and End dates with just the first 10 characters, and then using these vars in the email.  I wondered if there wasn't a way without creating yet more variables.

Oh well, I will update this post once I have tested .

Thanks again.

Daniel

Badge +9

Eric

Although, the workflow is pretty much completed. I thought I would tryout your suggestion on one of the .NET regex tools out there using a text string: 20/06/2016 00:00:00

.NET Regex Tester - Regex Storm

Unfortunately, I am not seeing a match.  In my case I wouldn't use a regex expression in my workflow unless I got a match using one of the tools.

Daniel

Userlevel 5
Badge +13

Hi Daniel,

The correct Pattern should be:  [0-9]+:[0-9]+:[0-9]+

Give that a try and let me know if that works.

Eric

Badge +8

Hello Daniel,

where you able to solve your issue, whit the hints of shaunlub​ or @eric

Thank you, regards

Oliver

Userlevel 5
Badge +12

Hi Daniel, did the suggested fix solve your issue?

Reply