Skip to main content
felixr
March 8, 2022
Solved

query returns different time

  • March 8, 2022
  • 3 replies
  • 0 views

in my database i have time in 24 hours format for example "8:00". when i create a query for this datetime what i receive is   a result with four hours difference how can i achieve to get it in the same time zone  as the database

    Best answer by andrewh0007

    ALWAYS save time in the database as UTC/GMT rather than your local time as once you start messing with time and timezones you're in for a bad time. Let Appian do all the hard work for you. If you need to force particular scenarios then check out the following functions. Also, check out Tom Scott's rant on timezones HERE [emoticon:c4563cd7d5574777a71c318021cbbcc8]

    https://docs.appian.com/suite/help/22.1/fnc_date_and_time_gmt.html

    https://docs.appian.com/suite/help/22.1/fnc_date_and_time_timezone.html

    https://docs.appian.com/suite/help/22.1/fnc_date_and_time_local.html

    But my strong suggestion would be to avoid at all costs messing with time. Work it where you can that you save into the database UTC/GMT value and let Appian convert it in the front end.

    3 replies

    stefanhelzle0001
    Brainy
    March 8, 2022

    Appian considers the data in the DB to be in UTC. I then will transform the data to your time zone. Important: This happens only in the presentation layer. The value itself is still UTC.

    andrewh0007
    March 8, 2022

    ALWAYS save time in the database as UTC/GMT rather than your local time as once you start messing with time and timezones you're in for a bad time. Let Appian do all the hard work for you. If you need to force particular scenarios then check out the following functions. Also, check out Tom Scott's rant on timezones HERE [emoticon:c4563cd7d5574777a71c318021cbbcc8]

    https://docs.appian.com/suite/help/22.1/fnc_date_and_time_gmt.html

    https://docs.appian.com/suite/help/22.1/fnc_date_and_time_timezone.html

    https://docs.appian.com/suite/help/22.1/fnc_date_and_time_local.html

    But my strong suggestion would be to avoid at all costs messing with time. Work it where you can that you save into the database UTC/GMT value and let Appian convert it in the front end.

    felixr
    felixrAuthor
    March 9, 2022

    Thanks you all guys