I have a simple line of code to display the formatted date from the selected row in a table. PeriodEnd column is configured with the correct name, Render=date, DateFormat is MM/DD/YYYY HH:mm:ss The date displays properly in the table when I reference it with a script the date is not formatted. Displays as 1682524800000
How do I get the formatted value in script???
self.getSibling("TextField").props.text=self.props.selection.data[0].PeriodEnd
Because the underlying data for dates and timestamps is milliseconds UTC (required to format on the browser end, with proper timezone handling). In a script, use system.date.fromMillis()
to get the true date object. Do not do formatting in scripts--that will screw up timezones if the client and the gateway are different. For databases, pass the date object itself into your named queries or scripted "Prep" queries--again, without string formatting.
Thank you !! Exactly what I needed. Solved.
{ Psst! Why did you mark yourself as the source of the solution? }
5 Likes