cancel
Showing results for 
Search instead for 
Did you mean: 

Using property expressions to convert a string to a date.

Patrick_Haught2
Champ on-the-rise
Champ on-the-rise

I have a file name being captured as part of a keyword    Example (X_XXX_XXXXX_07302020_XXX.TIF)

 

I'm using the arrayvalue function to grab the date segment of 07302020

 

I've tried the obvious format, cdate but I can't seem to turn 07302020 into 07/30/2020 so that it can then be saved to a date formatted keyword.

 

Thoughts?

Thanks.

1 ACCEPTED ANSWER

Larissa_Armand
Elite Collaborator
Elite Collaborator

If your dates will always be formatted as MMDDYYYY, this would work: 

Date(Right(%VpropInput;4);Left(%VpropInput;2);Right(Left(%VpropInput;4);2))

Regardless of the format, the Date() function should work better for you, CDate() would work if your date was already formatted as 07/30/2020 but as a string. Date() will take each value (year, month, day) and format that and treat it as a date data type.

View answer in original post

1 REPLY 1

Larissa_Armand
Elite Collaborator
Elite Collaborator

If your dates will always be formatted as MMDDYYYY, this would work: 

Date(Right(%VpropInput;4);Left(%VpropInput;2);Right(Left(%VpropInput;4);2))

Regardless of the format, the Date() function should work better for you, CDate() would work if your date was already formatted as 07/30/2020 but as a string. Date() will take each value (year, month, day) and format that and treat it as a date data type.