Start a new topic

RegEx to reformat date and strip timestamp

We are trying to build a dictionary to reformat the date below and remove the time stamp. Any suggestions?

2017-08-25 10:25:10-07:00


Hi Tom,

Is the end result you are looking for is a format of 8/25/2017?

Thanks,

John
Replacement value should be blank with Use Regular Expressions checked.
Value to match on = (?
Yes, John, the forma of 8/25/2017.
Therese, that doesn't seem to be working with our test date of this. 2017-08-25 10:25:10-07:00
On the first line of the dictionary you'll want value to match on to be (? On the second line you'll want value to match on to be (^\d{4})-(\d{2})-(\d{2}$) with a replacement value of $2/$3/$1

Check the RegEx box on both lines.

Thanks,

John
It works if there is a space after the date and before the T. However in the file tehre is no space. Suggestion?
2017-08-25 10:25:10-07:00
REPLACE
$2/$3/$1

MATCH
^(.+)-(.+)-(.+)T.*
Leave it to Wayne to do it in one line!
Terrific! Thanks so much to all!
Login or Signup to post a comment