Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

RegEx Separate Date and time

Asteroid

Hi Team,

How do I parse this field ( V-String) with RegEx

TimeStamp: 2019-03-25 15:02:58-04:00

 

My Output should be

Date: 2019-03-25 

Time: 15:02:58-04:00

 

Currenlty I am using ([\d]+)([\d]+)

which is returning 201 in Date coloumn and 9 in Time coloumn.

 

Thanks,

Rana

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner
Don't. That's how. If you copy the field to a new time field, you can get just the time. If you then change the type in a select, you can have just a date.

Keep it simple.

https://help.alteryx.com/current/Reference/DataFieldType.htm?Highlight=Data%20types

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
Alteryx
Alteryx

Hi there

 

Have a look at playing with these options:

 

- DateTime Parse tool

- Text to Columns (Crude way to split to the 2 columns you want)

- Use the DateTimeParse function within the Formula tool to parse the date out?

Highlighted
Alteryx Partner

I've never felt comfortable with regex, so my first attempt was this:

 

2019-05-09 07_33_17-c# Regex for numbers and dash only - Stack Overflow.png

 

Using this code:

 

(\d\d\d\d-\d\d-\d\d) (\d\d:\d\d:\d\d-\d\d:\d\d)

 

Then I tried a formula (just to NOT use regex)

 

2019-05-09 07_33_59-Alteryx Designer x64 - New Workflow2_.png

 

But I was hoping there was an easier way, so I did this:

 

2019-05-09 07_34_12-Alteryx Designer x64 - New Workflow2_.png  

 

([0-9\-]+) ([0-9\:\-]+)

 

Which feels like the best answer to me :) 

 

 

Labels