Current date/time on CRM server

Current date/time on CRM server

Post by George Dou » Sat, 05 May 2007 16:09:07


Hi everybody,

I need to get current date/time on the CRM server but could not find any SDK
method that would even remotely help me.
Note that I cannot talk to SQL Server, only CRM server otherwise I would
have directly issued simple T-SQL.

Am I missing something extremely simple here?

Cheers
--
George Doubinski
CRM Certified Professional - Developer
 
 
 

Current date/time on CRM server

Post by dU1hciBLaG » Sat, 05 May 2007 18:37:00

Hi,
I hope DateTime.Now property will help you.
http://www.yqcomputer.com/

--
PLEASE do click on Yes or No button if this post was helpful or not for our
feedback.

uMar Khan
Email for direct contact: imumar at gmail dot com

 
 
 

Current date/time on CRM server

Post by George Dou » Sat, 05 May 2007 19:01:51

I wish it was that easy, uMar :-)
DateTime.Now returns time on the machine where the code is executed which is
not necessarily CRM server. I need to be able to tell time on CRM server
while executing code on a client machine.

--
George Doubinski
CRM Certified Professional - Developer
 
 
 

Current date/time on CRM server

Post by rakes » Sat, 05 May 2007 19:44:05

if your aspx page resides on the server it should give the server date
time as the aspx page is on server.

regards
Rakesh Agarwal
 
 
 

Current date/time on CRM server

Post by George Dou » Sat, 05 May 2007 21:40:41

I never said I have an aspx page. I understand that if had a piece of code
that runs on the server then problem is solved but I have a client
application which talks to CRM server and I cannot assume anything else
being there.

--
George Doubinski
CRM Certified Professional - Developer
 
 
 

Current date/time on CRM server

Post by Michael Hn » Sun, 06 May 2007 03:53:13

i George,

What about using net time \\crmserver? Starting it with the Process class
gives you the opportunity to redirect the output and you could potentially
parse the returned date. Maybe there're some classes for it in the .NET
framework, but I never use it.
System.DirectoryServices.ActiveDirectory.DomainController.CurrentTime looks
promising, but seems to require the CRM server to be a DC.

Another option is to create a new entity of some kind, read it and look at
the creation date. After that delete the entity. You can also use a dummy
record, update it and use the modification date. Not ideal, but should work.

--
Michael Hne, Microsoft Dynamics CRM MVP

Web: http://www.stunnware.com/crm2
Feed: http://www.stunnware.com/crm2/atom.aspx
Custom Lookup Dialog: http://www.stunnware.com/crm2/?area=customLookup

----------------------------------------------------------

"George Doubinski" < XXXX@XXXXX.COM > schrieb im Newsbeitrag
news: XXXX@XXXXX.COM ...


 
 
 

Current date/time on CRM server

Post by George Dou » Tue, 08 May 2007 23:10:30

hanks Michael,

the equivalent of net time \\crmserver is to call NetRemoteTOD
(http://msdn2.microsoft.com/en-us/library/aa370612.aspx). (www.pinvoke.net
has a .NET equivalent)
Unfortunately, it's going to work only if server is on LAN. I really was
hoping that I missed something really simple in SDK but it looks like the
only reliable method is to create/read/delete fake record, as you suggested.

Oh, well, back to the drawing board.

Thanks
--
George Doubinski
CRM Certified Professional - Developer


"Michael Hne" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...