Start a new topic

Regex Exp for stripping time out of date field & Change US Dateto AU

Hey All,


We have a new email system that will only spit out dates with times..


Does anyone have a regex to strip the time out of the date field for importing a date?


Also, we need a regex to change a date field from MM/DD/YYYY to DD/MM/YYYY as the system we are using is american based (Salesforce Marketing Cloud) and may need to convert the dates


Thanks very much

Erin


Hi Erin,


Try this:


Replacement value: $2/$1/$3

Values to match on: ^(\d{2})/(\d{2})/(\d{4}).*?$


This should work assuming the field is formatted something like this: MM/DD/YYYY 00:00:00


Let me know how you go.


Ange

Hi Erin,

 

Try this: 

Replacement value: $2/$1/$3

Values to match on: ^(\d{2})/(\d{2})/(\d{4}).*?$ 

This should work assuming the field is formatted something like this: MM/DD/YYYY 00:00:00

Let me know how you go.

Ange

This knowledgebase article has some of the most commonly needed regex, including both things you are looking for: https://iom.uservoice.com/knowledgebase/articles/291286-what-are-some-commonly-used-regular-expressions-

Hi,


I use the below to remove the time stamp.


Replacement value is blank with the regular expressions box checked off.

Values to match on: (?<=[0-9]{4}).*


Hope that helps!

Hi Erin,


I've had to convert date formats when the cells are formatted as text and not read as dates. (Especially when they'v come from fuzzy date fields.)  With the help of a colleague created the attached Excel for converting them both ways (US to Intl and Intl to US).  Perhaps it will help you.

xlsx
This is the RegEx I use to remove time stamps from dates

(?<=\d+/\d+/\d+\s+).*

 

csv
(43 Bytes)
Login or Signup to post a comment