Hello everyone,
I am trying to give a format the t_stamp, for example the t_stamp as seen in the graph is 2023-07-11 12:32:00, I would like to change the format to 07/11/2023 for example.
Within the Data section in the SQL query with which commands could this be done?
Thanks in advanced!
Datetime formatting will depending on the DB type you're connecting to; based on the square brackets I'll guess MSSQL, so you'll probably want the FORMAT builtin:
Welcome to the forum but please post code, not screengrabs of code and certainly not photographs of code! There's also a code formatting </> button on the editor to format it correctly, preserve indents and apply syntax highlighting.
Have not been able to resolver this yet.
The recommended practice is to save and extract the data as UTC. Ignition does this by default.
Keep the data as a timestamp type and don't convert it to a string. Format it at the point of use as late as possible. In this case that's in the chart.
Ignition will display it corrected for the timezone specified in Project | Project Properties | Perspective | General | Project Timezone. You probably want to set this to Client rather than Gateway.
Well, not for MS SQL Server connections and their DATETIME column type, unless the GW-DB connection itself is in UTC.
Java with MS SQL Server is an interoperability nightmare.
I resolved the issue with the next code:
SELECT Convert (varchar, assy_cv1_stopcond.t_stamp, [number format]) * FROM assy_cv1_stopcond
Depending in the number fortmat you choose, you can have differetn type of date, time or datetime formats. Example:
SELECT Convert (varchar, getdate(), 1)
This code would give you the next output:
mm/dd/yy = 07/12/2023
Here is a link to all the numeric formats, and a good explanation of how to use date and time conversions using SQL Server: Date and Time Conversions Using SQL Server