Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Formula help String to Date

Hi All,

I have a field that is supposed to be a date field however I think its just a normal string.

I am trying to workout how I can turn it into a date so I can use it in my Record selection formula, I had some ideas but I don't understand how to use the split function.

my date field is in the following format as a string DD-MMM-YYYY.

this is how I imagine the formula would go... but its wrong any ideas?

Split({Date Field}) = array

Date(array(1),array(2),array(3))

Former Member
Former Member replied

SQL Server isn't going to have a problem displaying that field as a DateTime data type.

If you are using a SQL Command as your data source use the CAST (or CONVERT) function to switch the data type.

SELECT 
all the other fields,
 CAST(AM_WORDERS_CUF_T.ATTRIBUTE34 AS DateTime) AS ATTRIBUTE34
FROM AM_WORDERS_CUF_T

If you built the report by adding tables and linking them in CR then I'd add a very simple VIEW to the database...

Something like this:

CREATE VIEW RealDate AS 
SELECT ID, CAST(ATTRIBUTE34 AS DateTime) AS ATTRIBUTE34 FROM AM_WORDERS_CUF_T

I don't know what the primary key name is on AM_WORDERS_CUF_T so I just useda gereris ID. be sure to change it to the PK name of the table before creating the view.

Then all you would have to do is add the view to your table list... Link it to the original table on the ID field and use the ATTRIBUTE34 from the RealDate view.

HTH,

Jason

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question