none
Need to get user date defined format RRS feed

  • Question

  • When we set date (Regional Settings) on Delve and change the Locale, This is previously English US, then changed it to English UK. Now, date formats are different, i wonder if there is anyway, to find out what is the user defined locale (of the current logged in user). I will use that information to determine how to parse dates. thanks

    Monday, March 27, 2017 2:27 AM

All replies

  • Hi,

    We can use the following jQuery code to get the Regional Settings, add the following code into a script editor web part.

    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {	
    	var url = _spPageContextInfo.webAbsoluteUrl+"/_layouts/regionalsetng.aspx?Type=User";
    	var lcid, cultureInfo, timeZone;
    
    	$.get(url,function(data){
    		$(data).find("select[name$='LCID'] option:selected").each(function(){
    			lcid  = $(this).attr("value");
    			cultureInfo  = $(this).text();
    		});	
    		$(data).find("select[name$='TimeZone'] option:selected").each(function(){
    			timeZone  = $(this).text();
    		});
    		alert(lcid + "::" + cultureInfo + "::" + timeZone);
    	});
    });
    </script>

    More information:

    http://sympmarc.com/2014/08/20/detecting-the-current-users-regional-settings-with-jquery/

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, March 27, 2017 9:15 AM
    Moderator