Free Trial

Alteryx Designer Desktop Discussions

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

RegEx Separate Date and time

itahir04
8 - 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

 

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus
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 restart. Order shall return.
Please Subscribe to my youTube channel.
RishiK
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?

cmcclellan
14 - Magnetar

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
Top Solution Authors