We are currently performing maintenance on Appian Community. As a result, discussions posts and replies are temporarily unavailable. We appreciate your patience.

Having difficulties displaying dates across different timezones. Used

Having difficulties displaying dates across different timezones.

Used 'usertimezone(pp!initiator)' to capture the initiator's timezone (stored in a text field).
When we display the dates in subsequent screens we use 'local (pv!datetime,timezone) This does not display the correct time.
Now store the dates as text - yes they display correctly, but now have a new problem.
We use the pv!date_time values for validation. If we hide the date_time fields validation fails, if we display date_time, validation works but we have confusion showing allt he dates.

How can we get one solution that will work?...

OriginalPostID-39381

OriginalPostID-39381

  Discussion posts and replies are publicly visible

  • Some more information:
    I now capture timezone() - ourput fromt he first form in the process

    Display date/time (stored as text) = 08/02/2012 08:00 AM (what I entered)

    Display date/time (gmt(pv!datetime,timezone_int) = 8/2/2012 1:00 PM

    Display date/time (local(pv!datetime,timezone_int) = 8/2/2012 3:00 AM

    How can I get the original date to display correctly as a date/time data type
  • By the way, my Time Zone setting is 'Eastern Time (Canada/Eastern) yet timezone integer is showing -300 with the text field showing 'Canada/Eastern'
  • I am attaching an example application that shows an approach you can use to meet this requirement. Let me explain this with the example:

    1. Create a date time field in the form so the user can introduce the desired date and time (you already have this)
    2. In that same form create an hidden input or a custom output to store the user time zone: usertimezone(pp!initiator)
    ---> The result will be stored in a process variable of type text. In my example the text variable is called initiatorTimeZone
    *** 3. In the form where you are going to display this information in the original time zone you need to configure the "Refresh default values every time the task form is viewed" in the "Other" tab of the User Input Task properties.
    5. In that same form create a date time field and use the following expression as the default value:

    =local(gmt(pv!myDateTime,usertimezone(loggedInUser())),pv!initiatorTimeZone)
  • This will display the date and time in the original time zone. You can test the example by importing the application I uploaded at: forum.appian.com/.../55325. The process model is called Time in Diff Time Zones under Process Models - Forum
  • ou need to combine the functions in this way for the following reason:

    1. Date and Times are always stored in GMT in Appian
    2. Date and Times are displayed in the user's timezone (the user that is viewing the data)
    3. Date and Time functions always expect a value in GMT
    4. In this case in the first part of the expression I use the gmt() function to find the GMT equivalent of the date time variable indicating to this function that the passed date and time has been already adjusted to the user's (who is viewing the form) time zone.

    gmt(pv!myDateTime,usertimezone(loggedInUser()))
  • 5. Now that I have date shifted to GMT I can pass it safely to any other date-time function. In this case I need to shift it to the initiator's timezone to be able to display it in the original timezone in which it was provided. I do this using the local() function passing the result of what I explained in #4 and the timezone to where I want to shift the date and time to.

    =local(gmt(pv!myDateTime,usertimezone(loggedInUser())),pv!initiatorTimeZone)