web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Time Zone field requirement

(0) ShareShare
ReportReport
Posted on by 1,077

Hi All,

I have requirement, where need to create new field with timezone and populate it with as per customer region time.

Whenever support team go for a meeting with customer, they have to check their time zone on Google or with reference of customer inputs. 

How can i achieve this requirement.

Thanks in advanced

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    Create an organization own custom  entity called TimeZone where you can create a field  TimeZoneOffSet and use OOB Name field .

    Import or create  following value in the entity -

    Entity name ="TimeZone" 
    Field Name Value Field Name Value TimeZoneOffSet = "-12" Name = "(GMT -12:00) Eniwetok, Kwajalein" TimeZoneOffSet = "-11" Name = "(GMT -11:00) Midway Island, Samoa" TimeZoneOffSet = "-10" Name = "(GMT -10:00) Hawaii" TimeZoneOffSet = "-9" Name = "(GMT -9:00) Alaska" TimeZoneOffSet = "-8" Name = "(GMT -8:00) Pacific Time (US & Canada)" TimeZoneOffSet = "-7" Name = "(GMT -7:00) Mountain Time (US & Canada)" TimeZoneOffSet = "-6" Name = "(GMT -6:00) Central Time (US & Canada), Mexico City" TimeZoneOffSet = "-5" Name = "(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima" TimeZoneOffSet = "-4.5" Name = "(GMT -4:30) Caracas" TimeZoneOffSet = "-4" Name = "(GMT -4:00) Atlantic Time (Canada), La Paz, Santiago" TimeZoneOffSet = "-3.5" Name = "(GMT -3:30) Newfoundland" TimeZoneOffSet = "-3" Name = "(GMT -3:00) Brazil, Buenos Aires, Georgetown" TimeZoneOffSet = "-2" Name = "(GMT -2:00) Mid-Atlantic" TimeZoneOffSet = "-1" Name = "(GMT -1:00 hour) Azores, Cape Verde Islands" TimeZoneOffSet = "0" Name = "(GMT) Western Europe Time, London, Lisbon, Casablanca, Greenwich" TimeZoneOffSet = "1" Name = "(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris" TimeZoneOffSet = "2" Name = "(GMT +2:00) Kaliningrad, South Africa, Cairo" TimeZoneOffSet = "3" Name = "(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg" TimeZoneOffSet = "3.5" Name = "(GMT +3:30) Tehran" TimeZoneOffSet = "4" Name = "(GMT +4:00) Abu Dhabi, Muscat, Yerevan, Baku, Tbilisi" TimeZoneOffSet = "4.5" Name = "(GMT +4:30) Kabul" TimeZoneOffSet = "5" Name = "(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent" TimeZoneOffSet = "5.5" Name = "(GMT +5:30) Mumbai, Kolkata, Chennai, New Delhi" TimeZoneOffSet = "5.75" Name = "(GMT +5:45) Kathmandu" TimeZoneOffSet = "6" Name = "(GMT +6:00) Almaty, Dhaka, Colombo" TimeZoneOffSet = "6.5" Name = "(GMT +6:30) Yangon, Cocos Islands" TimeZoneOffSet = "7" Name = "(GMT +7:00) Bangkok, Hanoi, Jakarta" TimeZoneOffSet = "8" Name = "(GMT +8:00) Beijing, Perth, Singapore, Hong Kong" TimeZoneOffSet = "9" Name = "(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk" TimeZoneOffSet = "9.5" Name = "(GMT +9:30) Adelaide, Darwin" TimeZoneOffSet = "10" Name = "(GMT +10:00) Eastern Australia, Guam, Vladivostok" TimeZoneOffSet = "11" Name = "(GMT +11:00) Magadan, Solomon Islands, New Caledonia"


    Now create create a lookup field of timezone entity where you need to select the timezone.

    Now in the form on-load using javascript get the timezone offset - 

              


    For more information of retrieve offset for daylight saving you can follow below article  -

    https://www.onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/

    Once you get the timezoneoffset you can simply fetch the timezone from the enttiy and set the lookup value .

    You can also add a custom filter in the lookup by  which lookup will retrieve only client machine timezone.

          function GetTimezoneOffSetFromCliet() {
                //Get Timezone
                var rightNow = new Date();
                var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
                var temp = jan1.toGMTString();
                var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ") - 1));
                var timezoneoffset = (jan1 - jan2) / (1000 * 60 * 60);
    
                //Once you get the timezoneoffset value you can easily retrieve the timezone and get the lookup id, name and set the lookup field value
    
    
                // You can also set lookup filter by which user can only only select user machine timezone
                if (Xrm.Page.getControl("LookupFieldName") != null) {
                    Xrm.Page.getControl("LookupFieldName").addPreSearch(
                    function () {
                        ApplyTimezoneFilter(timezoneoffset);
                    });
                }           
            }       
    
            function ApplyTimezoneFilter(timezoneoffset) {
                var filter = "<filter type='and'>" +
                                        "<condition attribute='new_TimeZoneOffSet' operator='eq' value='" + timezoneoffset + "' />" +
                                  "</filter>";           
                Xrm.Page.getControl("LookupFieldName").addCustomFilter(filter);
            }





    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans