This documentation is archived and is not being maintained.

LocalTimeFromUtcTime Message (CrmService)

Dynamics
banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment typesWorks online and offline

Retrieves the local time for the specified Universal Time Coordinate (UTC) time.

The relevant classes are specified in the following table.

TypeClass
RequestLocalTimeFromUtcTimeRequest
ResponseLocalTimeFromUtcTimeResponse

Remarks

To use this message, pass an instance of the LocalTimeFromUtcTimeRequest class as the request parameter in the Execute method.

For a list of required privileges, see LocalTimeFromUtcTime Privileges.

Example

[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

CrmDateTime utcTime = new CrmDateTime();
                utcTime.Value = "2007-01-01T12:00:00"; 

// Create LocalTimeFromTime request.
LocalTimeFromUtcTimeRequest request = new LocalTimeFromUtcTimeRequest();
                
                // Note: TimeZoneCode 4 is PacificStandardTime
                request.TimeZoneCode = 4; 
                request.UtcTime = utcTime;

// Execute the request.
LocalTimeFromUtcTimeResponse response = (LocalTimeFromUtcTimeResponse) service.Execute(request);
CrmDateTime LocalTime = response.LocalTime;
[Visual Basic .NET]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim utcTime As New CrmDateTime()
utcTime.Value = "2007-01-01T12:00:00"

' Create LocalTimeFromTime request.
Dim request As New LocalTimeFromUtcTimeRequest()

' Note: TimeZoneCode 4 is PacificStandardTime.
request.TimeZoneCode = 4
request.UtcTime = utcTime

' Execute the request.
Dim response As LocalTimeFromUtcTimeResponse = CType(service.Execute(request), LocalTimeFromUtcTimeResponse)
Dim LocalTime As CrmDateTime = response.LocalTime

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show: