Splitting a date string

Hello, 

I am trying split a date and time string into separate date and time components, i.e. 01/04/2020 11:45:00 into 01/04/2020 and 11:45:00.

Can anyone help me create the a custom dimension or custom table calculation for this?  

0 1 898
1 REPLY 1

Chris_Tinnon
Participant III

This has to be defined as a custom dimension and not within the view file itself?

I’m not certain how to do this just as a dimension because, for whatever reason, you cant cast in a custom dimension. But you can cast in a custom calculation.

substring(to_string(${the_model.the_datetime_dimension}),1,10)

substring(to_string(${the_model.the_datetime_dimension}),12,8)

If you can do this in the model itself, though, that is the best idea. Your database dialect will certainly have the appropriate functions to do this correctly.

Top Labels in this Space
Top Solution Authors