Getting CRM User Date and Time Format Setting in Silverlight Microsoft CRM 2011

If you are working with Silverlight web resource and you need to get current crm user date time format then you can query usersettings entity and get datetime format setting for user. You can use below code for the same:

    public void RetrieveUserSettingRecord(Guid _UserID)
        {
         try
            {
                this._d.BeginInvoke(delegate()
                {
                    EntityReference EntityID = new EntityReference();
                    //the guid of the entity you want to retrieve
                    EntityID.Id = _UserID;
                    //the name of the entity type you want to retrieve
                    EntityID.LogicalName = "usersettings";
                    //define request type
                    OrganizationRequest request = new OrganizationRequest() { RequestName = "Retrieve" };
                    request["Target"] = EntityID;
                    ColumnSet columns = new ColumnSet();
                    columns.Columns = new System.Collections.ObjectModel.ObservableCollection<string>(new string[] { "dateformatstring", "timeformatstring" });
                    request["ColumnSet"] = columns;
                    IOrganizationService service = SilverlightUtility.GetSoapService();
                    //send the async request and specify it's callback
                    service.BeginExecute(request, new AsyncCallback(RetrieveCurrentUserSetting), service);

                });

            }
            catch (Exception ex)
            {
                throw ex;
            }


        }

        private void RetrieveCurrentUserSetting(IAsyncResult result)
        {
            try{
           
                this._d.BeginInvoke(delegate()
                {
                    OrganizationResponse Response = ((IOrganizationService)result.AsyncState).EndExecute(result);
                    SilverCrmSoap.CrmSdk.Entity _SystemUser = (SilverCrmSoap.CrmSdk.Entity)Response["Entity"];
                    if (_SystemUser.GetAttributeValue<string>("dateformatstring") != null)
                    {
                        string DateformatString = _SystemUser.GetAttributeValue<string>("dateformatstring");
                    }
                    if (_SystemUser.GetAttributeValue<string>("timeformatstring") != null)
                    {
                        string TimeFormatString = _SystemUser.GetAttributeValue<string>("timeformatstring");

                    }
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
           
        }

HIMBAP
We are expert in Microsoft Power Platform.