SharePoint Development Bookmark and Share   
 index > SharePoint - Development and Programming > How to get current datetime from sharepoint web application programatically
 

How to get current datetime from sharepoint web application programatically

Hi,

I am using Microsoft.Sharepoint assembly for my code.
I have been trying to get the current datetime of sharepoint web application but have not been able to find anything relevant.
Does anyone know how to retrieve current datetime?

Thanks in advance,
Amrita
Amrita Singh  Tuesday, March 17, 2009 4:21 AM
You can use "SPUtility.GetServerNow(Your spweb object);" and add it "using Microsoft.SharePoint.Utilities;" at the top

Anna Jhaveri  Tuesday, March 17, 2009 4:45 AM
Thanks Anna,

This method would return the CurrentDateTime of the SPWeb rite?
My problem is, I had been taking the server's time i.e. DateTime.Now.

But the time of the server and time of the sharepoint web application is different and therefore I am having problems.

Amrita Singh  Tuesday, March 17, 2009 5:09 AM
yes it will return current time of spweb
Anna Jhaveri  Tuesday, March 17, 2009 5:13 AM

You can use google to search for other answers

Custom Search

More Threads

• ShowInEditForm not functional
• Custom Application Page - 403 FORBIDDEN
• Accessing external databases
• Run iisapp on windows server 2008
• Excel services and Graph
• Enum with Private Property for Sorting List results in a drop down list returns error:Object of type 'System.String' cannot be converted to Enum . . .
• Custom Action <URL Action trouble with Javascript window.Open
• how to create organization tree web part on WSS 3.0
• How to populate data in sharepoint's webpart from datatable
• Programmatically Create a SubSite from template / definition