Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
shirleyc40
Creator
Creator

Timestamp to Date returns null

I have a timestamp from SQL in the form 'MM/DD/YYYY hh:mm:ss.fff TT' The type of it is varchar

I tried Date(timestamp#(eventDate, 'MM/DD/YYYY hh:mm:ss.fff TT'))  but it returns null. I tried using subfield: 

Date#(SubField(EventDateTime, ' ', 1), 'MM/DD/YYYY') which returns 'MM/DD/YYYY', but when I try to wrap it in the date function, I get null again. But if I manually put in a string it works. I'm confused on how I can make this timestamp  into a date so I can use it in the date picker

Labels (2)
13 Replies
shirleyc40
Creator
Creator
Author

Thanks for the help! It's a date type now, but the date picker visualization doesn't seem to detect it as an option. Would you know why?

Vegar
MVP
MVP

Did create it in the script or are you just defining it in the application as an dimension? Try to create it in the load script then you would probably find it as an option.

Vegar
MVP
MVP

I noticed something odd with your timestamp. 

03/06/2020 16:11:11.508 PM   is not a valid timestamp. 

It looks like your source is combining 24 hour time with 12 AM/PM. A correct timestamp would be either

03/06/2020 04:11:11.508 PM 

or

03/06/2020 16:11:11.508

 

Given this odd format @NitinK7  provided a good workaround using subfield fetching only the date part.

shirleyc40
Creator
Creator
Author

The date was created in the script, and thanks for pointing out the error in timestamp