cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Regular Expression to remove time after the year of the date

 I have  Run If action I am trying to use, but the 2 dates I'm comparing are showing the time after them as well. 

Using the Log History action, I found my 2 dates are never comparing correctly because they're coming out like this:

Run If  9/25/2018 1:01:45 PM = 9/25/2018 12:00:00 AM

I would like an email to send if  9/25/2018 = 9/25/2018     

How can I trim the string so only the date shows? I would like the string after 2018 ignored and extracted into a variable because if I count from the beginning or end to trim it, when the month is a 2-digit month the results will be different. I need to change 9/25/2018 1:01:45 PM  to be only 9/25/2018 and extract to a variable. Any ideas? 

0 Kudos
Reply
4 Replies
Workflow Hero

Re: Regular Expression to remove time after the year of the date


Hi Mark,
 
You can try converting both variables into a string  , Build String and  use the fn-FormatDate (date, "MM / d / yyyy")

Hope this can help you

Regards,
Reva Eka Patria

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Regular Expression to remove time after the year of the date

Thank you, Reva! I hadn't tried Build String-- I will try it to practice. I was able to solve the problem using:

Extract Substring from Start of String:

My Wednesday Reminder Date was formatting like this originally: 10/2/2018 12:00:00 AM
So I extracted 9 characters from start of the string which leaves me only with this: 10/2/2018

I am hoping it works with single digit months as well, but maybe that's where I'll need to build a string. Would the space at the end be part of the date if I extract 9 characters from the beginning of a date with a single digit month?  9/2/2018#  

I wonder if that would mess up my workflow then. 

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Regular Expression to remove time after the year of the date

Hi Mark.

If you use your solution then you will find a problem like that.
You can use the "string build" or "Set Variable" action with FormatDate Function and the result is a String Format.
fn-FormatDate(dateCreated,"MM/d/yyyy")
Resutl : 02/17/2017
So you can compare it. 

If the answer is correct,  So please mark the answer as correct.
Regards,
Reva Eka Patria

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Regular Expression to remove time after the year of the date

Hi All,

I have a leading 1 in my Date Column values in SharePoint List.

The Data is like Below.

Date Opened = 760308 ,731225,990125,970609,970702,1000112

 760308  =  March 8th, 1976

731225 = December 25th, 1973

990125 = January 25th, 1999

970609 = June 9th, 1997

970702 = July 2nd, 1997

1000112 = January 12th, 2000

Basically,I need to change them into MMDDYYYY format.Is there a way we can achieve this format by removing the leading 1 in front of dates .Please let me know if you have any questions.Thank You

0 Kudos
Accept as Solution Reply