You are viewing limited content. For full access, please sign in.

Question

Question

convert string to date

asked on June 8, 2016

Is there any way I can convert a string (either \d\d\d\d\d\d or \d\d/\d\d/\d\d) to a Date in Quickfields?  I've looked all over, and I can't find the answer.  Please help!

0 0

Answer

SELECTED ANSWER
replied on June 8, 2016

I figured it out.  My first two digits were my year, but when I was doing the substitution I was putting the year in the front!  I feel so dumb.  Thanks for your help!

1 0

Replies

replied on June 8, 2016

Alternately - if there's a way to get pattern matching to pull a date out of a string where the date is separated by hyphens instead of "/" that would work....

My initial input is blahblah-yy-MM-dd-blahblah  I'm picking the text up through OCR.  If I pull the date out via \d\d-\d\d-\d\d it becomes a string object instead of a date object.  Help!

0 0
replied on June 8, 2016

Hello Tonya, 

If i am am understanding what you are asking correctly, you can use \d\d-\d\d-\d\d\d\d.  I tested this in Workflow with the input string of asdfs5646540502-03-201681681s888s1 and it does extract the date correctly as 02-03-2016.  

0 0
replied on June 8, 2016

It will extract the date correctly as a String, but I need the token to go into a Date field, so how do you find

 

-(yy-MM-dd)-

 

Am I missing \ or / or % or #?

0 0
replied on June 8, 2016 Show version history

I would use three unique tokens, YToken, MToken, and DToken, to extract the parts of the date so that you can reconstruct the date in the order needed, yy-MM-dd.  Your dialogue for the metadata entry of the tokens would then be %YToken-%MToken-%DToken.

\d\d- will return MToken

-\d\d-(\d\d) will return YToken

\d\d-(\d\d)-\d\d\d\d will return DToken

 

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.