Datetime formatting issue

Create a dashboard with two datetime inputs. Convert these UTC times to the server's local time and format them for SQL Server's smalldatetime type. Then, query the database for records within that range and send the results to a chart.

26/09/2025, 16:22:54node: debug 15
sensor_data_query : msg.payload : Object
object
query: string

        SELECT [Id], [SensorName], [SensorValue], [Alert], [Timestamp]
        FROM [IndustrialDB].[dbo].[SensorData]
        WHERE [Timestamp] BETWEEN ? AND ?
        ORDER BY [Timestamp] ASC

params: array[2]
0: "2025-09-25 10:58:00"
1: "2025-09-26 11:03:00"


Welcome to the foum @azan5050

Are these your instructions to people trying to reply in the forum, or your boss's instructions to you?

1 Like

my boss instruction to me

Are you asking for help? If so what is the question?

Not knowing which dashboard you are using , guess dashboard2

You can also use a form to collect all input
example flow


look in dashboard2

example flow json How to import/export a flow

[{"id":"98faa405e180b3a6","type":"ui-form","z":"d1395164b4eec73e","name":"","group":"9d83cd8b3d5ee33c","label":"","order":1,"width":0,"height":0,"options":[{"label":"date from","key":"dfrom","type":"date","required":true,"rows":null},{"label":"time from","key":"tfrom","type":"time","required":true,"rows":null},{"label":"date to","key":"dto","type":"date","required":true,"rows":null},{"label":"time to","key":"tto","type":"time","required":true,"rows":null}],"formValue":{"dfrom":"","tfrom":"","dto":"","tto":""},"payload":"","submit":"submit","cancel":"clear","resetOnSubmit":false,"topic":"topic","topicType":"msg","splitLayout":true,"className":"","passthru":false,"dropdownOptions":[],"x":710,"y":2120,"wires":[["01bedafdbd172c91"]]},{"id":"01bedafdbd172c91","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"[\n\"{{payload.dfrom}} {{payload.tfrom}}\",\n\"{{payload.dto}} {{payload.tto}}\"\n]","output":"json","x":880,"y":2120,"wires":[["f25551b1d24cfba0"]]},{"id":"f25551b1d24cfba0","type":"debug","z":"d1395164b4eec73e","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1060,"y":2120,"wires":[]},{"id":"9d83cd8b3d5ee33c","type":"ui-group","name":"Group1","page":"c694d0ebe0d2b702","width":"6","height":"1","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"c694d0ebe0d2b702","type":"ui-page","name":"Page1","ui":"1805777f90e92057","path":"/page1","icon":"home","layout":"grid","theme":"35ee7753b5b3599b","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":1,"className":"","visible":"true","disabled":"false"},{"id":"1805777f90e92057","type":"ui-base","name":"dashboard ","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","titleBarStyle":"default","showReconnectNotification":false,"notificationDisplayTime":"5","showDisconnectNotification":false},{"id":"35ee7753b5b3599b","type":"ui-theme","name":"Theme Name","colors":{"surface":"#16234b","primary":"#1d44b9","bgPage":"#ecf2f8","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

There are also many examples of how to format a timestamp (both unix and iso) using change node and $moment and $fromMillis using JSONATA.
You can also use days.js and moment.js in a function node.
There is also the moment contrib node.
If you search the form for more info, there is plenty available.

The top bar colour in the screenshot screens old/depreciated node-red-dashboard (not Dasboard-2)