question

kauan pedroso avatar image
0 Likes"
kauan pedroso asked Jason Lightfoot commented

Change column type from int to Datetime

hey guys

I need some help, I have a table that the data comes from a SQL SERVE database but in the date columns the values are coming in seconds. How can I do to change this?

as is in FlexSim

1676657986117.png

as is in SQL SERVE

1676658475290.png



FlexSim 21.2.4
global tablesql querysql serve
1676657986117.png (3.0 KiB)
1676658475290.png (128.8 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

It is possible to customize the table view to show the numeric value as a date time string - but you should ask the developers to add that as a standard formatting option for a table in the Ideas section.

In your select statement you can use for each field respectively the DateTime constructor to get the string value:

  1. DateTime(InputTimestamp).toString() AS InputTimestamp

You can change how the string is formatted using a format string.

Note that once it's a string in FlexSIm and manipulates are harder so it's easier to work with the numeric value. For this reason I'd import the numeric value AND a formatted string into two columns for now:

  1. SELECT InputTimestamp, DateTime(InputTimestamp).toString() AS InputDatetimeStr FROM....
· 10
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.