Date type columns in dataset not outputting as expected

I’m trying to build functionality into perspective that allows a user to select from a dropdown of upload dates and display the image that was uploaded. The issue I’m running into is that the dates look good in the dataset I’ve imported them to (a query binding on the “Options” property, but when I try to open the dropdown from the screen, they’re a series of incorrect numbers. I’ve tried converting the dates within the sql statement and haven’t gotten anything different. The dates are stored in the DB as DATETIME and the column in the dataset is of the type: date. Is there a good way to accomplish this? Is the dropdown the correct object?


You are probably seeing something like this in your dropdown.

I don’t know why, hopefully another reader can explain, somewhere along the line your datetime is getting interpreted as epoch time. You can cast the datetime field as a string in your query, you just need to take into account that its a string when you go to retrieve your image.

Edit: Actually its probably better to use system.dataset.formatDates in a script transform.

I wound up solving this. I used a value and a label column in my query.

SELECT TimeEntered AS value, DATE_FORMAT(TimeEntered, '%m/%e/%Y - %H:%i:%s') as label from Receiving_Images