Issues with specific timezone only

Certified Associate Developer

Hello All,

 

I have an application where I used datetime component. When user selects any date and time it shows the correct time based on users profile setting but when user sets IST as there timezone then it shows the time which is 30 minutes less. It works fine for all other timezones. Any suggestion about this issue?

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    I'm not familiar with any timezone issues like this, but if the issue is happening consistently with the IST timezone and it is always 30 minutes off, could you handle the exception with an expression rule?  If the user's time zone is an available input on the form where they are entering the datetime, you could add 30 minutes to the saved value if IST.  This doesn't address why this timezone specifically is off, but it might work as a band-aid solution.

    load(
        local!date:todatetime(now()),
        local!timeZone:"IST",
        local!adjustedDate:if(local!timeZone="IST",local!date+minute(30),local!date),
        local!adjustedDate
    )

  • IST is 5:30 hours ahead of UTC.  Are you seeing that offset as +5 hours instead?  Does it only affect the datetime component or are other time related components / functions also affected?  Here is an output of now() for me when my profile is set to IST:

     

     

    It matches the expected time that I double checked https://www.timeanddate.com/time/zones/ist for.

  • So I came across this for release notes:

    docs.appian.com/.../Appian_Release_Notes.html

    "Timezone Changes
    With this update, we perfectly matched timezone offsets and daylight savings observance. If you have designed adjustments into your applications to compensate for the previous disparities, those work-arounds may no longer be valid."

    What version of Appian are you using? It looks like some previous versions may have had timezone offset issues in which case you'd have to implement Mitchell's suggested solution. I would put that into it's own expression rule and use it across your application, that way if you upgrade Appian to a version that no longer needs this offset correction you can just update the one expression rule.
  • 0
    Certified Associate Developer
    in reply to Larry Nguyen
    Hi Larry,

    Thanks for your research and reply. I really appreciate your help. Let me briefly explain about my design first

    1) I'm on appian 18.1
    2) When we use just now() function then code works absolutely fine. It shows the time in proper IST format but we have selected a standard design to store datetime value i.e. YYYY-MM-DDThh:mm:ss(gmt)
    3) Now what I'm doing is during the time of saving selected value into the variable, I'm calling an expression rule and performing below operation to save the value into required format


    load(
    local!isDateNull:or(
    isnull(ri!date_dt),
    len(ri!date_dt)=0
    ),

    local!gmtDateTime:if(local!isDateNull,null,gmt(ri!date_dt)),
    local!year:if(local!isDateNull,null,year(local!gmtDateTime)),
    local!month:if(local!isDateNull,null,month(local!gmtDateTime)),
    local!day:if(local!isDateNull,null,day(local!gmtDateTime)),
    local!hour:if(local!isDateNull,null,hour(totime(local(local!gmtDateTime)))),
    local!min:if(local!isDateNull,null,minute(local!gmtDateTime)),
    local!sec:if(local!isDateNull,null,second(local!gmtDateTime)),

    if(
    and(
    isnull(local!year),
    isnull(local!month),
    isnull(local!day),
    isnull(local!hour),
    isnull(local!min),
    isnull(local!sec)
    ),
    null,
    concat(
    local!year,
    "-",
    if(len(local!month)=1,"0"&local!month,local!month),
    "-",
    if(len(local!day)=1,"0"&local!day,local!day),
    "T",
    if(len(local!hour)=1,"0"&local!hour,local!hour),
    ":",
    if(len(local!min)=1,"0"&local!min,local!min),
    ":",
    if(len(local!sec)=1,"0"&local!sec,local!sec)
    )
    )
    )

    4) So this above mentioned rule is used to convert datetime into specified format and for displaying purpose we are converting the values again into its respective format by using below rule

    =datetime(mid(ri!datestring,1,4),mid(ri!datestring,6,2),mid(ri!datestring,9,2),mid(ri!datestring,12,2),mid(ri!datestring,15,2),mid(ri!datestring,18,2))

    Is there something i'm doing wrong in above code? As I said its happening only for IST timezone and for IST daylight concept is not available i guess.
  • 0
    Certified Associate Developer
    in reply to mitchellg
    Hi Mitchell,

    Thank you so much for your reply. I thought of using this approach but what if this issue got resolved in near future? I have to change the code again?