Date format changing to epoch time format when assigned as a variable

When assigning a variable name to date column in a MSSQL table the date format is changing from “yyyy/mm/dd” to an epoch format. I need to keep it in a “yyyy/mm/dd” format to allow end users to select a specific date from the pull-down list.

  • What Grafana version and what operating system are you using?
    8.1.1

  • What are you trying to achieve?
    Create a pull down list of report dates that an end user can select to show the respective graph for that date

  • How are you trying to achieve it?
    Assign a variable name to the date column in a MSSQL table. The date format is yyyy/mm/dd in the table.
    Variable query: select distinct(Report_Date) from visual

  • What happened?
    The preview/results shows up as an epoch time
    Example: 1628640000000

  • What did you expect to happen?
    Date format being “yyyy/mm/dd”

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    no

  • Did you follow any online instructions? If so, what is the URL?
    None instructions

you want to create a new date dropdown?
why not use the existing one?

The dates in the db are static dates relating to unique static data sets that occurred on the selected date. The data viewed is all static and there is no relationship to the time picker other than changing the graph resolution. The end user would select a date to view the specific static data (note: it works as it should in V6, the only difference the DB is Influx instead MSSQL)

Solution: select distinct convert(varchar, Report_Date) from visual

2 Likes

This topic was automatically closed after 365 days. New replies are no longer allowed.