Change Date and Time based on user time zone

Certified Lead Developer

Hi All,

I have a use case where I need to convert Date and time based on user time zone.

I have a date and time component, and if user of timezone CDT selects date and time as "4/1/2022 11:46 AM CDT" and submits the case. If another user of time zone IST logs in then they should be able to see the date and time value as "4/1/2022 10:16 PM IST" (whatever the usertime zone is). Based on user time zone date and time value needs to be changed in UI.

I have tried with todatetime(), gmt() and usertimezone() functions but none of them works.

Please provide your suggestions.

Thanks

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    Hi Mike,

    For example, am using a dateAndTime component and am using datatype of text to save it. On doing so, my value will get saved as "4/1/2022 11:46 AM CDT". On retrieving it from DB, the same value will be retrieved. Is there any way to save the dateTime value in GMT format(as am using Text datatype) to DB and retrieve it, so that based on usertime zone dateTime value will be changed.

    Or is there any other way other than saving the value as GMT, any functions?

Children